@Override public long putIfAbsent(K key, long value) { int index = insert(key, value); if (index < 0) { // key was absent return defaultValue(); } else { // key is present return values[index]; } }
@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 putIfAbsent(K key, long value) { int index = insert(key, value); if (index < 0) { // key was absent return defaultValue(); } else { // key is present return values[index]; } }
@Override public long put(K key, long value) { int index = insert(key, value); if (index < 0) { // key was absent return defaultValue(); } else { // key is present long[] vals = values; long prevValue = vals[index]; vals[index] = value; return prevValue; } }
@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(); } }
@Override public long put(K key, long value) { int index = insert(key, value); if (index < 0) { // key was absent return defaultValue(); } else { // key is present long[] vals = values; long prevValue = vals[index]; vals[index] = value; return prevValue; } }
@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(); } }
long newValue = remappingFunction.applyAsLong(null, defaultValue()); incrementModCount(); keys[index] = null;
long newValue = remappingFunction.applyAsLong(null, defaultValue()); incrementModCount(); keys[index] = null;
long newValue = remappingFunction.applyAsLong(key, defaultValue()); incrementModCount(); keys[index] = key;
long newValue = remappingFunction.applyAsLong(key, defaultValue()); incrementModCount(); keys[index] = key;