@Override public boolean removeIf(Predicate<? super Float> filter) { if (filter == null) throw new java.lang.NullPointerException(); if (isEmpty()) return false; boolean changed = false; int mc = modCount(); int[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { int key; if ((key = keys[i]) < FREE_BITS) { if (filter.test(Float.intBitsToFloat(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 boolean containsEntry(int 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 void justPut(int 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 removeAt(int index) { incrementModCount(); super.removeAt(index); values[index] = null; postRemoveHook(); }
@Override public void reversePutAllTo(InternalFloatObjMapOps<? super V> m) { if (isEmpty()) return; int mc = modCount(); int[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { int key; if ((key = keys[i]) < FREE_BITS) { m.justPut(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
int firstRemoved; if (cur <= FREE_BITS) { if (noRemoved()) { int bIndex = index, fIndex = index, step = 1; while (true) { incrementModCount(); keys[firstRemoved] = k; vals[firstRemoved] = value; postRemovedSlotInsertHook(); return value; incrementModCount(); keys[index] = k; vals[index] = value; postFreeSlotInsertHook(); return value; return newValue; } else { incrementModCount(); keys[index] = REMOVED_BITS; vals[index] = null; postRemoveHook(); return null;
public V computeIfPresent(Float key, BiFunction<? super Float, ? super V, ? extends V> remappingFunction) { int k = Float.floatToIntBits(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(Float.intBitsToFloat(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 @Nonnull public <V2 extends V> HashFloatObjMap<V2> newMutableMap(Map<Float, ? extends V2> map1, Map<Float, ? extends V2> map2) { MutableQHashSeparateKVFloatObjMapGO<V2> res = uninitializedMutableMap(); res.move(newUpdatableMap(map1, map2)); return res; }
@Override public V get(float key) { int k = Float.floatToIntBits(key); int index = index(k); if (index >= 0) { // key is present return values[index]; } else { // key is absent return null; } }
@Override void rehash(int newCapacity) { int mc = modCount(); int[] keys = set; V[] vals = values; initForRehash(newCapacity); if (mc != modCount()) throw new java.util.ConcurrentModificationException();
@Override @Nonnull public <V2 extends V> MutableQHashSeparateKVFloatObjMapGO<V2> newMutableMap(int expectedSize) { MutableQHashSeparateKVFloatObjMapGO<V2> map = uninitializedMutableMap(); map.init(configWrapper, expectedSize); return map; }
int firstRemoved; if (cur <= FREE_BITS) { if (noRemoved()) { int bIndex = index, fIndex = index, step = 1; while (true) { incrementModCount(); keys[firstRemoved] = k; vals[firstRemoved] = value; postRemovedSlotInsertHook(); return value; incrementModCount(); keys[index] = k; vals[index] = value; postFreeSlotInsertHook(); return value; return newValue; } else { incrementModCount(); keys[index] = REMOVED_BITS; vals[index] = null; postRemoveHook(); return null;
@Override public void forEach(BiConsumer<? super Float, ? super V> action) { if (action == null) throw new java.lang.NullPointerException(); if (isEmpty()) return; int mc = modCount(); int[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { int key; if ((key = keys[i]) < FREE_BITS) { action.accept(Float.intBitsToFloat(key), vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override @Nonnull public <V2 extends V> HashFloatObjMap<V2> newMutableMapOf(float k1, V2 v1, float k2, V2 v2, float k3, V2 v3, float k4, V2 v4, float k5, V2 v5) { MutableQHashSeparateKVFloatObjMapGO<V2> map = uninitializedMutableMap(); map.move(newUpdatableMapOf(k1, v1, k2, v2, k3, v3, k4, v4, k5, v5)); return map; }
@Override public V get(Object key) { int k = Float.floatToIntBits((Float) key); int index = index(k); if (index >= 0) { // key is present return values[index]; } else { // key is absent return null; } }
@Override void removeAt(int index) { incrementModCount(); super.removeAt(index); values[index] = null; postRemoveHook(); }
@Override void rehash(int newCapacity) { int mc = modCount(); int[] keys = set; V[] vals = values; initForRehash(newCapacity); if (mc != modCount()) throw new java.util.ConcurrentModificationException();