Example #1
0
  /** {@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) {
      long key = in.readLong();
      long val = in.readLong();
      put(key, val);
    }
  }
Example #2
0
  /** {@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.writeLong(_set[i]);
        out.writeLong(_values[i]);
      }
    }
  }
Example #3
0
 /** {@inheritDoc} */
 protected void removeAt(int index) {
   _values[index] = no_entry_value;
   super.removeAt(index); // clear key, state; adjust size
 }
Example #4
0
 /** {@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);
 }