public void clear() {
   super.clear();
   final int[] keys = this._set;
   final Object[] vals = this._values;
   final byte[] states = this._states;
   Arrays.fill(this._set, 0, this._set.length, 0);
   Arrays.fill(this._values, 0, this._values.length, null);
   Arrays.fill(this._states, 0, this._states.length, (byte) 0);
 }
    /**
     * Expand the internal storage buffers (capacity) or rehash current keys and values if there are
     * a lot of deleted slots.
     */
    private void expandAndRehash() {
      final Object[] oldKeys = this.keys;

      assert assigned >= resizeThreshold;
      allocateBuffers(nextCapacity(keys.length));

      /*
       * Rehash all assigned slots from the old hash table.
       */
      final int mask = keys.length - 1;
      for (int i = 0; i < oldKeys.length; i++) {
        final Object key = oldKeys[i];
        if (key != null) {
          int slot = rehash(key) & mask;
          while (keys[slot] != null) {
            slot = (slot + 1) & mask;
          }
          keys[slot] = key;
        }
      }
      Arrays.fill(oldKeys, null);
    }
 public void clear() {
   assigned = 0;
   Arrays.fill(keys, null);
 }
예제 #4
0
파일: BPGroup.java 프로젝트: antoniou/vfork
 public PGroupElementArray toElementArray(int size, PGroupElement element) {
   PGroupElement[] res = new PGroupElement[size];
   Arrays.fill(res, element);
   return new BPGroupElementArray(this, res);
 }