@Override public Long get(Object key) { int index = index((Short) 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((Short) key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue; } }
@Override public long getOrDefault(short 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((Short) 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((Short) key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue; } }
@Override public boolean containsEntry(short 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(short 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(short 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 replace(Short 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(Short 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(short 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(short 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 get(short key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue(); } }
@Override public long replace(short 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 get(short key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue(); } }
@Override public Long computeIfPresent(Short key, BiFunction<? super Short, ? super Long, ? extends Long> remappingFunction) { short k = key; if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(k); if (index >= 0) { // key is present long[] vals = values; Long newValue = remappingFunction.apply(k, 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 replace(short 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(Short key, BiFunction<? super Short, ? super Long, ? extends Long> remappingFunction) { short k = key; if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(k); if (index >= 0) { // key is present long[] vals = values; Long newValue = remappingFunction.apply(k, 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(short key, ShortLongToLongFunction 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(short key, ShortLongToLongFunction 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(); } }