@SuppressWarnings("unchecked") @Override public V get(K key) { Objects.requireNonNull(key); int index = find(key); if (index != -1) { return (V) getValue(index); } return null; }
@SuppressWarnings("unchecked") @Override public V get(K key) { Objects.requireNonNull(key); int index = find(key); if (index != -1) { return (V) getValue(index); } return null; }
@SuppressWarnings("unchecked") @Override public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) { for (int i = 0; i < totalEntries; i++) { Object entryKey = getKey(i); if (entryKey != null) { Object newValue = function.apply((K) entryKey, (V) getValue(i)); setValue(i, newValue); } } }
@SuppressWarnings("unchecked") @Override public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) { for (int i = 0; i < totalEntries; i++) { Object entryKey = getKey(i); if (entryKey != null) { Object newValue = function.apply((K) entryKey, (V) getValue(i)); setValue(i, newValue); } } }
newEntries[(z << 1) + 1] = getValue(i); z++;
newEntries[(z << 1) + 1] = getValue(i); z++;
@SuppressWarnings("unchecked") @Override public V removeKey(K key) { if (key == null) { throw new UnsupportedOperationException("null not supported as key!"); } int index; if (hasHashArray()) { index = this.findAndRemoveHash(key); } else { index = this.findLinear(key); } if (index != -1) { Object value = getValue(index); remove(index); return (V) value; } return null; }
@SuppressWarnings("unchecked") @Override public V removeKey(K key) { if (key == null) { throw new UnsupportedOperationException("null not supported as key!"); } int index; if (hasHashArray()) { index = this.findAndRemoveHash(key); } else { index = this.findLinear(key); } if (index != -1) { Object value = getValue(index); remove(index); return (V) value; } return null; }
Object oldValue = getValue(index); setValue(index, value); return (V) oldValue;
Object oldValue = getValue(index); setValue(index, value); return (V) oldValue;