public class EquivalentLinkedHashMap<K,V> extends EquivalentHashMap<K,V>
Equivalence
function implementations for keys
and values, as opposed to relying on their own equals/hashCode/toString
implementations. This is handy when using key/values whose mentioned
methods cannot be overriden, i.e. arrays, and in situations where users
want to avoid using wrapper objects.
In order to provide linked list behaviour, entries are linked with each
other in a predictable order.Modifier and Type | Class and Description |
---|---|
private class |
EquivalentLinkedHashMap.EntryIterator |
private class |
EquivalentLinkedHashMap.EquivalentLinkedHashIterator<T> |
static class |
EquivalentLinkedHashMap.IterationOrder |
private class |
EquivalentLinkedHashMap.KeyIterator |
private static class |
EquivalentLinkedHashMap.LinkedEntry<K,V>
Exported Entry for iterators
|
private static class |
EquivalentLinkedHashMap.LinkedNode<K,V> |
private class |
EquivalentLinkedHashMap.ValueIterator |
EquivalentHashMap.EntrySet, EquivalentHashMap.MapEntry<K,V>, EquivalentHashMap.Node<K,V>, EquivalentHashMap.Values
AbstractMap.SimpleEntry<K,V>
Modifier and Type | Field and Description |
---|---|
private EquivalentLinkedHashMap.LinkedNode<K,V> |
header |
private EquivalentLinkedHashMap.IterationOrder |
iterationOrder |
modCount, size
entrySet, keySet, values
Constructor and Description |
---|
EquivalentLinkedHashMap(int initialCapacity,
float loadFactor,
EquivalentLinkedHashMap.IterationOrder iterationOrder,
Equivalence<K> keyEq,
Equivalence<V> valueEq) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addEntry(int index,
K key,
V value,
int hash) |
private void |
addFirstEntry() |
void |
clear() |
private <K,V> EquivalentLinkedHashMap.LinkedNode<K,V> |
createLinkedNode() |
(package private) EquivalentHashMap.Node<K,V> |
createNode(K key,
V value,
int hash,
EquivalentHashMap.Node<K,V> node) |
V |
get(java.lang.Object key) |
(package private) java.util.Iterator<java.util.Map.Entry<K,V>> |
newEntryIterator() |
(package private) java.util.Iterator<K> |
newKeyIterator() |
(package private) java.util.Iterator<V> |
newValueIterator() |
V |
remove(java.lang.Object key) |
protected boolean |
removeEldestEntry(java.util.Map.Entry<K,V> eldest) |
containsKey, containsValue, entrySet, equals, getKeyEquivalence, getNode, getValueEquivalence, isEmpty, keySet, put, putAll, removeNode, resize, size, transfer, values
assertKeyNotNull, eq, hash, hashCode
private transient EquivalentLinkedHashMap.LinkedNode<K,V> header
private final EquivalentLinkedHashMap.IterationOrder iterationOrder
public EquivalentLinkedHashMap(int initialCapacity, float loadFactor, EquivalentLinkedHashMap.IterationOrder iterationOrder, Equivalence<K> keyEq, Equivalence<V> valueEq)
private void addFirstEntry()
void addEntry(int index, K key, V value, int hash)
addEntry
in class EquivalentHashMap<K,V>
private <K,V> EquivalentLinkedHashMap.LinkedNode<K,V> createLinkedNode()
EquivalentHashMap.Node<K,V> createNode(K key, V value, int hash, EquivalentHashMap.Node<K,V> node)
createNode
in class EquivalentHashMap<K,V>
public V get(java.lang.Object key)
public V remove(java.lang.Object key)
public void clear()
java.util.Iterator<K> newKeyIterator()
newKeyIterator
in class EquivalentHashMap<K,V>
java.util.Iterator<V> newValueIterator()
newValueIterator
in class EquivalentHashMap<K,V>
java.util.Iterator<java.util.Map.Entry<K,V>> newEntryIterator()
newEntryIterator
in class EquivalentHashMap<K,V>