Class BiMapV>

java.lang.Object
com.itextpdf.commons.datastructures.BiMapV>
Type Parameters:
K - the type of the first key
V - the type of the second key

public final class BiMapV> extends Object
A simple bi-directional map.
  • Constructor Details

    • BiMap

      public BiMap()
      Creates a new BiMap instance.
  • Method Details

    • 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 key
      v - 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