Class BiMap<K,V>
- java.lang.Object
-
- com.itextpdf.commons.datastructures.BiMap<K,V>
-
- Type Parameters:
K- the type of the first keyV- the type of the second key
public final class BiMap<K,V> extends java.lang.ObjectA simple bi-directional map.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()removes all entries from the map.booleancontainsKey(K k)Checks if the map contains the key.booleancontainsValue(V v)Checks if the map contains the value.VgetByKey(K value)Gets the value by key.KgetByValue(V key)Gets the key by value.booleanisEmpty()Checks if the map is empty.voidput(K k, V v)Puts the entry into the map.voidremoveByKey(K k)Removes the entry by key.voidremoveByValue(V v)Removes the entry by value.intsize()Gets the size of the map.
-
-
-
Constructor Detail
-
BiMap
public BiMap()
Creates a newBiMapinstance.
-
-
Method Detail
-
put
public void put(K k, V v)
Puts the entry into the map. If the key already exists, the value will be overwritten. If the value already exists, the key will be overwritten. If both key and value already exist, the entry will be overwritten. If neither key nor value already exist, the entry will be added.- Parameters:
k- the keyv- the value
-
getByKey
public V getByKey(K value)
Gets the value by key.- Parameters:
value- the key- Returns:
- the value
-
getByValue
public K getByValue(V key)
Gets the key by value.- Parameters:
key- the value- Returns:
- the key
-
removeByKey
public void removeByKey(K k)
Removes the entry by key.- Parameters:
k- the key
-
removeByValue
public void removeByValue(V v)
Removes the entry by value.- Parameters:
v- the value
-
size
public int size()
Gets the size of the map.- Returns:
- the size of the map
-
clear
public void clear()
removes all entries from the map.
-
isEmpty
public boolean isEmpty()
Checks if the map is empty.- Returns:
- true, if the map is empty
-
containsKey
public boolean containsKey(K k)
Checks if the map contains the key.- Parameters:
k- the key- Returns:
- true, if the map contains the key
-
containsValue
public boolean containsValue(V v)
Checks if the map contains the value.- Parameters:
v- the value- Returns:
- true, if the map contains the value
-
-