@Override public Short getOrDefault(Object key, Short 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, short value) { int index = index(key); if (index >= 0) { // key is present return values[index] == value; } else { // key is absent return false; } }
@Override public Short replace(K key, Short value) { int index = index(key); if (index >= 0) { // key is present short[] vals = values; short oldValue = vals[index]; vals[index] = value; return oldValue; } else { // key is absent return null; } }
@Override public Short get(Object key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return null; } }
@Override public Short getOrDefault(Object key, Short defaultValue) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue; } }
@Override public short getOrDefault(Object key, short 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, short value) { int index = index(key); if (index >= 0) { // key is present return values[index] == value; } else { // key is absent return false; } }
@Override public Short get(Object key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return null; } }
@Override public short getOrDefault(Object key, short defaultValue) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue; } }
@Override public boolean replace(K key, short oldValue, short newValue) { int index = index(key); if (index >= 0) { // key is present short[] vals = values; if (vals[index] == oldValue) { vals[index] = newValue; return true; } else { return false; } } else { // key is absent return false; } }
@Override public Short replace(K key, Short value) { int index = index(key); if (index >= 0) { // key is present short[] vals = values; short oldValue = vals[index]; vals[index] = value; return oldValue; } else { // key is absent return null; } }
@Override public boolean replace(K key, short oldValue, short newValue) { int index = index(key); if (index >= 0) { // key is present short[] vals = values; if (vals[index] == oldValue) { vals[index] = newValue; return true; } else { return false; } } else { // key is absent return false; } }
@Override public short getShort(Object key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue(); } }
@Override public Short computeIfPresent(K key, BiFunction<? super K, ? super Short, ? extends Short> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present short[] vals = values; Short 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 short getShort(Object key) { int index = index(key); if (index >= 0) { // key is present return values[index]; } else { // key is absent return defaultValue(); } }
@Override public short replace(K key, short value) { int index = index(key); if (index >= 0) { // key is present short[] vals = values; short oldValue = vals[index]; vals[index] = value; return oldValue; } else { // key is absent return defaultValue(); } }
@Override public short replace(K key, short value) { int index = index(key); if (index >= 0) { // key is present short[] vals = values; short oldValue = vals[index]; vals[index] = value; return oldValue; } else { // key is absent return defaultValue(); } }
public Short computeIfPresent(K key, BiFunction<? super K, ? super Short, ? extends Short> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present short[] vals = values; Short 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 short computeIfPresent(K key, ObjShortToShortFunction<? super K> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present short[] vals = values; short newValue = remappingFunction.applyAsShort(key, vals[index]); vals[index] = newValue; return newValue; } else { // key is absent return defaultValue(); } }
@Override public short computeIfPresent(K key, ObjShortToShortFunction<? super K> remappingFunction) { if (remappingFunction == null) throw new java.lang.NullPointerException(); int index = index(key); if (index >= 0) { // key is present short[] vals = values; short newValue = remappingFunction.applyAsShort(key, vals[index]); vals[index] = newValue; return newValue; } else { // key is absent return defaultValue(); } }