@Override public Long getOrDefault(Object key, Long defaultValue) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue; } }
@Override public boolean containsEntry(Object key, long value) { int index = index(key); if (index >= 0) { // key is present return values[index] == value; } else { // key is absent return false; } }
@Override public long getOrDefault(Object key, long defaultValue) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue; } }
@Override public Long get(Object key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return null; } }
@Override public Long getOrDefault(Object key, Long defaultValue) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue; } }
@Override public boolean containsEntry(Object key, long value) { int index = index(key); if (index >= 0) { // key is present return values[index] == value; } else { // key is absent return false; } }
@Override public Long get(Object key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return null; } }
@Override public long getOrDefault(Object key, long defaultValue) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue; } }
@Override public Long replace(K key, Long value) { int index = index(key); if (index >= 0) { // key is present long[] vals = values; long oldValue = vals[index]; vals[index] = value; return oldValue; } else { // key is absent return null; } }
@Override public Long replace(K key, Long value) { int index = index(key); if (index >= 0) { // key is present long[] vals = values; long oldValue = vals[index]; vals[index] = value; return oldValue; } else { // key is absent return null; } }
@Override public boolean replace(K key, long oldValue, long newValue) { int index = index(key); if (index >= 0) { // key is present long[] vals = values; if (vals[index] == oldValue) { vals[index] = newValue; return true; } else { return false; } } else { // key is absent return false; } }
@Override public boolean replace(K key, long oldValue, long newValue) { int index = index(key); if (index >= 0) { // key is present long[] vals = values; if (vals[index] == oldValue) { vals[index] = newValue; return true; } else { return false; } } else { // key is absent return false; } }
@Override public Long computeIfPresent(K key, BiFunction<? super K, ? super Long, ? extends Long> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present long[] vals = values; Long newValue = remappingFunction.apply(key, vals[index]); if (newValue != null) { vals[index] = newValue; return newValue; } else { throw new java.lang.UnsupportedOperationException("ComputeIfPresent operation of updatable map doesn't support removals"); } } else { // key is absent return null; } }
@Override public long getLong(Object key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue(); } }
@Override public long getLong(Object key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue(); } }
@Override public long replace(K key, long value) { int index = index(key); if (index >= 0) { // key is present long[] vals = values; long oldValue = vals[index]; vals[index] = value; return oldValue; } else { // key is absent return defaultValue(); } }
@Override public long replace(K key, long value) { int index = index(key); if (index >= 0) { // key is present long[] vals = values; long oldValue = vals[index]; vals[index] = value; return oldValue; } else { // key is absent return defaultValue(); } }
public Long computeIfPresent(K key, BiFunction<? super K, ? super Long, ? extends Long> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present long[] vals = values; Long newValue = remappingFunction.apply(key, vals[index]); if (newValue != null) { vals[index] = newValue; return newValue; } else { throw new java.lang.UnsupportedOperationException("ComputeIfPresent operation of updatable map doesn't support removals"); } } else { // key is absent return null; } }
@Override public long computeIfPresent(K key, ObjLongToLongFunction<? super K> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present long[] vals = values; long newValue = remappingFunction.applyAsLong(key, vals[index]); vals[index] = newValue; return newValue; } else { // key is absent return defaultValue(); } }
@Override public long computeIfPresent(K key, ObjLongToLongFunction<? super K> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present long[] vals = values; long newValue = remappingFunction.applyAsLong(key, vals[index]); vals[index] = newValue; return newValue; } else { // key is absent return defaultValue(); } }