/** {@inheritDoc} */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION in.readByte(); // SUPER super.readExternal(in); // NUMBER OF ENTRIES int size = in.readInt(); setUp(size); // ENTRIES while (size-- > 0) { byte key = in.readByte(); short val = in.readShort(); put(key, val); } }
/** {@inheritDoc} */ public void writeExternal(ObjectOutput out) throws IOException { // VERSION out.writeByte(0); // SUPER super.writeExternal(out); // NUMBER OF ENTRIES out.writeInt(_size); // ENTRIES for (int i = _states.length; i-- > 0; ) { if (_states[i] == FULL) { out.writeByte(_set[i]); out.writeShort(_values[i]); } } }
/** {@inheritDoc} */ protected void removeAt(int index) { _values[index] = no_entry_value; super.removeAt(index); // clear key, state; adjust size }
/** {@inheritDoc} */ public void clear() { super.clear(); Arrays.fill(_set, 0, _set.length, no_entry_key); Arrays.fill(_values, 0, _values.length, no_entry_value); Arrays.fill(_states, 0, _states.length, FREE); }