V applyIfPresent(K key, int hash, IBiFunction<? super K, ? super V, ? extends V> remappingFunction) { lock(); try { V oldValue = get(key, hash); if (oldValue == null) { return null; } V newValue = remappingFunction.apply(key, oldValue); if (newValue == null) { removeInternal(key, hash, oldValue, false); return null; } else { putInternal(key, hash, newValue, null, false); return newValue; } } finally { unlock(); } }
V applyIfPresent(K key, int hash, IBiFunction<? super K, ? super V, ? extends V> remappingFunction) { lock(); try { V oldValue = get(key, hash); if (oldValue == null) { return null; } V newValue = remappingFunction.apply(key, oldValue); if (newValue == null) { removeInternal(key, hash, oldValue, false); return null; } else { putInternal(key, hash, newValue, null, false); return newValue; } } finally { unlock(); } }
V merge(K key, V value, int hash, IBiFunction<? super V, ? super V, ? extends V> remappingFunction) { lock(); try { V oldValue = get(key, hash); V newValue = (oldValue == null) ? value : remappingFunction.apply(oldValue, value); if (newValue == null) { removeInternal(key, hash, oldValue, false); return null; } else { putInternal(key, hash, newValue, null, false); return newValue; } } finally { unlock(); } }
V merge(K key, V value, int hash, IBiFunction<? super V, ? super V, ? extends V> remappingFunction) { lock(); try { V oldValue = get(key, hash); V newValue = (oldValue == null) ? value : remappingFunction.apply(oldValue, value); if (newValue == null) { removeInternal(key, hash, oldValue, false); return null; } else { putInternal(key, hash, newValue, null, false); return newValue; } } finally { unlock(); } }
/** * This method must be called with exactly one of <code>value</code> and * <code>function</code> non-null. **/ V put(K key, int hash, V value, IFunction<? super K, ? extends V> function, boolean onlyIfAbsent) { lock(); try { return putInternal(key, hash, value, function, onlyIfAbsent); } finally { unlock(); } }
/** * This method must be called with exactly one of <code>value</code> and * <code>function</code> non-null. **/ V put(K key, int hash, V value, IFunction<? super K, ? extends V> function, boolean onlyIfAbsent) { lock(); try { return putInternal(key, hash, value, function, onlyIfAbsent); } finally { unlock(); } }