K
- The key type.V
- The value type.public class TwoWayHashMap<K,V>
extends java.util.HashMap<K,V>
Constructor and Description |
---|
TwoWayHashMap()
Construct an empty two-way hash map.
|
TwoWayHashMap(int initialCapacity)
Construct an empty two-way hash map with an initial capacity.
|
TwoWayHashMap(int initialCapacity,
float loadFactor)
Construct an empty two-way hash map with an initial capacity and a load
factor.
|
TwoWayHashMap(java.util.Map<? extends K,? extends V> map)
Construct a two-way hash map with the given hash map, which must have a
one-to-one relationship between elements.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear this two-way hash map.
|
java.lang.Object |
clone()
Clone this two-way hash map and return the clone.
|
boolean |
containsValue(java.lang.Object value)
Test whether this two-way hash map contains the given value.
|
K |
getKey(java.lang.Object value)
Given a value, return the corresponding key in this two-way hash map.
|
V |
put(K key,
V value)
Put a value into this two-way hash map and associate it with a key.
|
V |
remove(java.lang.Object key)
Remove the value associated with the given key.
|
java.util.Set<V> |
values()
Return a set containing all the values in this two-way hash map.
|
compute, computeIfAbsent, computeIfPresent, containsKey, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, size
public TwoWayHashMap()
public TwoWayHashMap(java.util.Map<? extends K,? extends V> map)
map
- The hash map.public TwoWayHashMap(int initialCapacity)
initialCapacity
- The initial capacity.public TwoWayHashMap(int initialCapacity, float loadFactor)
initialCapacity
- The initial capacity.loadFactor
- The load factor.public void clear()
public java.lang.Object clone()
public boolean containsValue(java.lang.Object value)
public K getKey(java.lang.Object value)
value
- The value.public V put(K key, V value)
public V remove(java.lang.Object key)