public class EquivalentHashMap<K,V> extends AbstractMap<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.
This hash map implementation is optimised for store/retrieval rather
than iteration. Internal node entries are not linked, so responsibility to
link them falls on the iterators.HashMap
Modifier and Type | Class and Description |
---|---|
class |
EquivalentHashMap.EntrySet |
protected static class |
EquivalentHashMap.Node<K,V> |
class |
EquivalentHashMap.Values |
AbstractMap.SimpleEntry<K,V>
entrySet, keySet, values
Constructor and Description |
---|
EquivalentHashMap(Equivalence<? super K> keyEq,
Equivalence<? super V> valueEq) |
EquivalentHashMap(int initialCapacity,
Equivalence<? super K> keyEq,
Equivalence<? super V> valueEq) |
EquivalentHashMap(int initialCapacity,
float loadFactor,
Equivalence<? super K> keyEq,
Equivalence<? super V> valueEq) |
EquivalentHashMap(Map<? extends K,? extends V> map,
Equivalence<? super K> keyEq,
Equivalence<? super V> valueEq) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object o) |
V |
get(Object key) |
Equivalence<? super K> |
getKeyEquivalence() |
Equivalence<? super V> |
getValueEquivalence() |
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
V |
remove(Object key) |
int |
size() |
Collection<V> |
values() |
assertKeyNotNull, eq, hash, hashCode
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public EquivalentHashMap(Equivalence<? super K> keyEq, Equivalence<? super V> valueEq)
public EquivalentHashMap(int initialCapacity, Equivalence<? super K> keyEq, Equivalence<? super V> valueEq)
public EquivalentHashMap(int initialCapacity, float loadFactor, Equivalence<? super K> keyEq, Equivalence<? super V> valueEq)
public EquivalentHashMap(Map<? extends K,? extends V> map, Equivalence<? super K> keyEq, Equivalence<? super V> valueEq)
public int size()
public boolean isEmpty()
public boolean containsKey(Object key)
public boolean containsValue(Object value)
public void clear()
public boolean equals(Object o)
public Equivalence<? super K> getKeyEquivalence()
public Equivalence<? super V> getValueEquivalence()
public Collection<V> values()
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.