/** {@inheritDoc} */
  @Override
  public short set(int offset, short val) {
    if (offset >= _pos) {
      throw new ArrayIndexOutOfBoundsException(offset);
    }

    short prev_val = _data.get(offset);
    _data.put(offset, val);
    return prev_val;
  }
  @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {

    // VERSION
    in.readByte();

    // POSITION
    _pos = in.readInt();

    // NO_ENTRY_VALUE
    no_entry_value = in.readShort();

    // ENTRIES
    int len = in.readInt();
    _data = new TShortOffheapArray(len);
    for (int i = 0; i < len; i++) {
      _data.put(i, in.readShort());
    }
  }
 /** {@inheritDoc} */
 @Override
 public void transformValues(TShortFunction function) {
   for (int i = _pos; i-- > 0; ) {
     _data.put(i, function.execute(_data.get(i)));
   }
 }
 /** Sets the value at the specified offset without doing any bounds checking. */
 public void setQuick(int offset, short val) {
   _data.put(offset, val);
 }
 /** {@inheritDoc} */
 @Override
 public boolean add(short val) {
   ensureCapacity(_pos + 1);
   _data.put(_pos++, val);
   return true;
 }