@Override public <Z> Z findResult(LongObjFunction<? super T, ? extends Z> function) { AtomicReference<Z> result = new AtomicReference<>(); forEachWhile((key, value) -> { Z tmp = function.apply(key, value); if (tmp != null) { result.set(tmp); return false; } return true; }); return result.get(); } }
@Override public V computeIfPresent(long key, LongObjFunction<? super V, ? extends V> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(key, val); if (newValue != null) { vals[index] = newValue; return newValue; } else { throw new java.lang.UnsupportedOperationException("ComputeIfPresent operation of updatable map doesn't support removals"); } } else { return null; } } else { // key is absent return null; } }
@Override public V computeIfPresent(long key, LongObjFunction<? super V, ? extends V> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(key, val); if (newValue != null) { vals[index] = newValue; return newValue; } else { throw new java.lang.UnsupportedOperationException("ComputeIfPresent operation of updatable map doesn't support removals"); } } else { return null; } } else { // key is absent return null; } }
@Override public V computeIfPresent(long key, LongObjFunction<? super V, ? extends V> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(key, val); if (newValue != null) { vals[index] = newValue; return newValue; } else { throw new java.lang.UnsupportedOperationException("ComputeIfPresent operation of updatable map doesn't support removals"); } } else { return null; } } else { // key is absent return null; } }
@Override public V computeIfPresent(long key, LongObjFunction<? super V, ? extends V> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(key, val); if (newValue != null) { vals[index] = newValue; return newValue; } else { throw new java.lang.UnsupportedOperationException("ComputeIfPresent operation of updatable map doesn't support removals"); } } else { return null; } } else { // key is absent return null; } }
@Override public void replaceAll(LongObjFunction<? super V, ? extends V> function) { if (function == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { vals[i] = function.apply(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public void replaceAll(LongObjFunction<? super V, ? extends V> function) { if (function == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long removed = removedValue; long[] keys = set; V[] vals = values; if (noRemoved()) { for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { vals[i] = function.apply(key, vals[i]); } } } else { for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free && key != removed) { vals[i] = function.apply(key, vals[i]); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public void replaceAll(LongObjFunction<? super V, ? extends V> function) { if (function == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { vals[i] = function.apply(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public void replaceAll(LongObjFunction<? super V, ? extends V> function) { if (function == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { vals[i] = function.apply(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public V computeIfPresent(long key, LongObjFunction<? super V, ? extends V> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(key, val); if (newValue != null) { vals[index] = newValue; return newValue; } else { removeAt(index); return null; } } else { return null; } } else { // key is absent return null; } }
@Override public void replaceAll(LongObjFunction<? super V, ? extends V> function) { if (function == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { vals[i] = function.apply(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public V computeIfPresent(long key, LongObjFunction<? super V, ? extends V> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(key, val); if (newValue != null) { vals[index] = newValue; return newValue; } else { removeAt(index); return null; } } else { return null; } } else { // key is absent return null; } }
@Override public void replaceAll(LongObjFunction<? super V, ? extends V> function) { if (function == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { vals[i] = function.apply(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public void replaceAll(LongObjFunction<? super V, ? extends V> function) { if (function == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long[] keys = set; V[] vals = values; for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { vals[i] = function.apply(key, vals[i]); } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public void replaceAll(LongObjFunction<? super V, ? extends V> function) { if (function == null) throw new java.lang.NullPointerException(); if (this.isEmpty()) return; int mc = modCount(); long free = freeValue; long removed = removedValue; long[] keys = set; V[] vals = values; if (noRemoved()) { for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free) { vals[i] = function.apply(key, vals[i]); } } } else { for (int i = keys.length - 1; i >= 0; i--) { long key; if ((key = keys[i]) != free && key != removed) { vals[i] = function.apply(key, vals[i]); } } } if (mc != modCount()) throw new java.util.ConcurrentModificationException(); }
@Override public V computeIfPresent(long key, LongObjFunction<? super V, ? extends V> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(key, val); if (newValue != null) { vals[index] = newValue; return newValue; } else { incrementModCount(); set[index] = removedValue; vals[index] = null; postRemoveHook(); return null; } } else { return null; } } else { // key is absent return null; } }
@Override public V computeIfPresent(long key, LongObjFunction<? super V, ? extends V> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present V[] vals = values; V val; if ((val = vals[index]) != null) { V newValue = remappingFunction.apply(key, val); if (newValue != null) { vals[index] = newValue; return newValue; } else { incrementModCount(); set[index] = removedValue; vals[index] = null; postRemoveHook(); return null; } } else { return null; } } else { // key is absent return null; } }