/** {@inheritDoc} */
    public boolean retainAll(int[] array) {
      boolean changed = false;
      Arrays.sort(array);
      int[] values = _values;
      byte[] states = _states;

      for (int i = values.length; i-- > 0; ) {
        if (states[i] == FULL && (Arrays.binarySearch(array, values[i]) < 0)) {
          removeAt(i);
          changed = true;
        }
      }
      return changed;
    }
Esempio n. 2
0
    /** {@inheritDoc} */
    public boolean retainAll(long[] array) {
      boolean changed = false;
      Arrays.sort(array);
      long[] set = _set;
      byte[] states = _states;

      for (int i = set.length; i-- > 0; ) {
        if (states[i] == FULL && (Arrays.binarySearch(array, set[i]) < 0)) {
          removeAt(i);
          changed = true;
        }
      }
      return changed;
    }
    /** {@inheritDoc} */
    @Override
    public boolean retainAll(char[] array) {
      boolean changed = false;
      Arrays.sort(array);
      TCharOffheapArray values = _values;
      TByteOffheapArray states = _states;

      for (int i = capacity(); i-- > 0; ) {
        if (states.get(i) == FULL && (Arrays.binarySearch(array, values.get(i)) < 0)) {
          removeAt(i);
          changed = true;
        }
      }
      return changed;
    }
 /**
  * Creates a new <code>TIntIntHashMap</code> instance containing all of the entries in the map
  * passed in.
  *
  * @param map a <tt>TIntIntMap</tt> that will be duplicated.
  */
 public TIntIntHashMap(TIntIntMap map) {
   super(map.size());
   if (map instanceof TIntIntHashMap) {
     TIntIntHashMap hashmap = (TIntIntHashMap) map;
     this._loadFactor = hashmap._loadFactor;
     this.no_entry_key = hashmap.no_entry_key;
     this.no_entry_value = hashmap.no_entry_value;
     //noinspection RedundantCast
     if (this.no_entry_key != (int) 0) {
       Arrays.fill(_set, this.no_entry_key);
     }
     //noinspection RedundantCast
     if (this.no_entry_value != (int) 0) {
       Arrays.fill(_values, this.no_entry_value);
     }
     setUp((int) Math.ceil(DEFAULT_CAPACITY / _loadFactor));
   }
   putAll(map);
 }
 /** {@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);
 }