public V remove(K key) { checkNotNull(key); long h = hash(key); return getSection(h).remove(key, null, (int) h); }
public boolean remove(K key, Object value) { checkNotNull(key); checkNotNull(value); long h = hash(key); return getSection(h).remove(key, value, (int) h) != null; }
private static <K, V> void insertKeyValueNoLock(Object[] table, int capacity, K key, V value) { int bucket = signSafeMod(hash(key), capacity); while (true) { K storedKey = (K) table[bucket]; if (storedKey == EmptyKey) { // The bucket is empty, so we can use it table[bucket] = key; table[bucket + 1] = value; return; } bucket = (bucket + 2) & (table.length - 1); } } }
public V putIfAbsent(K key, V value) { checkNotNull(key); checkNotNull(value); long h = hash(key); return getSection(h).put(key, value, (int) h, true, null); }
public V computeIfAbsent(K key, Function<K, V> provider) { checkNotNull(key); checkNotNull(provider); long h = hash(key); return getSection(h).put(key, null, (int) h, true, provider); }
public V put(K key, V value) { checkNotNull(key); checkNotNull(value); long h = hash(key); return getSection(h).put(key, value, (int) h, false, null); }
public V get(K key) { checkNotNull(key); long h = hash(key); return getSection(h).get(key, (int) h); }
public V remove(K key) { checkNotNull(key); long h = hash(key); return getSection(h).remove(key, null, (int) h); }
public boolean remove(K key, Object value) { checkNotNull(key); checkNotNull(value); long h = hash(key); return getSection(h).remove(key, value, (int) h) != null; }
private static <K, V> void insertKeyValueNoLock(Object[] table, int capacity, K key, V value) { int bucket = signSafeMod(hash(key), capacity); while (true) { K storedKey = (K) table[bucket]; if (storedKey == EmptyKey) { // The bucket is empty, so we can use it table[bucket] = key; table[bucket + 1] = value; return; } bucket = (bucket + 2) & (table.length - 1); } } }
public V putIfAbsent(K key, V value) { checkNotNull(key); checkNotNull(value); long h = hash(key); return getSection(h).put(key, value, (int) h, true, null); }
public V put(K key, V value) { checkNotNull(key); checkNotNull(value); long h = hash(key); return getSection(h).put(key, value, (int) h, false, null); }
public V computeIfAbsent(K key, Function<K, V> provider) { checkNotNull(key); checkNotNull(provider); long h = hash(key); return getSection(h).put(key, null, (int) h, true, provider); }
public V get(K key) { checkNotNull(key); long h = hash(key); return getSection(h).get(key, (int) h); }