@Override public void clear() { doClear(); }
@Override void removeAt(int index) { incrementModCount(); super.removeAt(index); values[index] = null; postRemoveHook(); }
@Override public boolean containsEntry(long key, Object value) { int index = index(key); if (index >= 0) { // key is present return nullableValueEquals(values[index], (V) value); } else { // key is absent return false; } }
@Override public int hashCode() { int hashCode = 0; int mc = modCount(); long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { hashCode += ((int) (key ^ (key >>> 32))) ^ nullableValueHashCode(vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return hashCode; }
@Override public boolean removeIf(Predicate<? super Double> filter) { if (filter == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { if (filter.test(Double.longBitsToDouble(key))) { incrementModCount(); mc++; keys[i] = REMOVED_BITS; vals[i] = null; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public void reversePutAllTo(InternalDoubleObjMapOps<? super V> m) { if (this.isEmpty()) return; int mc = modCount(); long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { m.justPut(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override @Nonnull public <V2 extends V> HashDoubleObjMap<V2> newMutableMap(Map<Double, ? extends V2> map1, Map<Double, ? extends V2> map2, Map<Double, ? extends V2> map3, Map<Double, ? extends V2> map4, int expectedSize) { MutableQHashSeparateKVDoubleObjMapGO<V2> res = uninitializedMutableMap(); res.move(this.<V2>newUpdatableMap(map1, map2, map3, map4, expectedSize)); return res; }
@Override public V computeIfPresent(double key, DoubleObjFunction<? super V, ? extends V> remappingFunction) { long k = Double.doubleToLongBits(key); if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(k); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(Double.longBitsToDouble(k), val); if (newValue != null) { vals[index] = newValue; return newValue; } else { incrementModCount(); set[index] = REMOVED_BITS; vals[index] = null; postRemoveHook(); return null; } } else { return null; } } else { // key is absent return null; } }
@Override public V get(Object key) { long k = Double.doubleToLongBits((Double) key); int index = index(k); if (index >= 0) { // key is present return values[index]; } else { // key is absent return null; } }
@Override public void justPut(long key, V value) { int index = insert(key, value); if (index < 0) { // key was absent return; } else { // key is present values[index] = value; return; } }
@Override void rehash(int newCapacity) { int mc = modCount(); long[] keys = set; V[] vals = values; initForRehash(newCapacity); if (mc != modCount()) throw new java.util.ConcurrentModificationException();
@Override @Nonnull public <V2 extends V> MutableQHashSeparateKVDoubleObjMapGO<V2> newMutableMap(int expectedSize) { MutableQHashSeparateKVDoubleObjMapGO<V2> map = uninitializedMutableMap(); map.init(configWrapper, expectedSize); return map; }
@Override public boolean removeIf(DoublePredicate filter) { if (filter == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return false; boolean changed = false; int mc = modCount(); long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { if (filter.test(Double.longBitsToDouble(key))) { incrementModCount(); mc++; keys[i] = REMOVED_BITS; vals[i] = null; postRemoveHook(); changed = true; } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); return changed; }
@Override public void reversePutAllTo(InternalDoubleObjMapOps<? super V> m) { if (this.isEmpty()) return; int mc = modCount(); long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) < FREE_BITS) { m.justPut(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override @Nonnull public <V2 extends V> HashDoubleObjMap<V2> newMutableMap( Double[] keys, V2[] values, int expectedSize) { MutableQHashSeparateKVDoubleObjMapGO<V2> map = uninitializedMutableMap(); map.move(this.<V2>newUpdatableMap(keys, values, expectedSize)); return map; }
@Override public V get(double key) { long k = Double.doubleToLongBits(key); int index = index(k); if (index >= 0) { // key is present return values[index]; } else { // key is absent return null; } }
@Override public void justPut(long key, V value) { int index = insert(key, value); if (index < 0) { // key was absent return; } else { // key is present values[index] = value; return; } }