K - The key type to use.V - THe value type to use.@Private
@Evolving
public final class IdentityHashStore<K,V>
extends java.lang.Object
System.identityHashCode(Object) and the identity operator.
This is useful for types like ByteBuffer which have expensive hashCode
and equals operators.
We use linear probing to resolve collisions. This avoids the need for
the overhead of linked list data structures. It also means that it is
expensive to attempt to remove an element that isn't there, since we
have to look at the entire array to be sure that it doesn't exist.| Modifier and Type | Class | Description |
|---|---|---|
static interface |
IdentityHashStore.Visitor<K,V> |
| Constructor | Description |
|---|---|
IdentityHashStore(int capacity) |
| Modifier and Type | Method | Description |
|---|---|---|
int |
capacity() |
|
V |
get(K k) |
Retrieve a value associated with a given key.
|
boolean |
isEmpty() |
|
int |
numElements() |
|
void |
put(K k,
V v) |
Add a new (key, value) mapping.
|
V |
remove(K k) |
Retrieve a value associated with a given key, and delete the
relevant entry.
|
void |
visitAll(IdentityHashStore.Visitor<K,V> visitor) |
Visit all key, value pairs in the IdentityHashStore.
|
public void put(K k, V v)
k - Generics Type k.v - Generics Type v.public V get(K k)
k - Generics Type k.public V remove(K k)
k - Generics Type k.public boolean isEmpty()
public int numElements()
public int capacity()
public void visitAll(IdentityHashStore.Visitor<K,V> visitor)
visitor - visitor.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.