Class ListValueMap<K,V>

java.lang.Object
org.sejda.commons.collection.ListValueMap<K,V>
Type Parameters:
K - key generic type
V - value generic type

public final class ListValueMap<K,V> extends Object
Map where the elements added to the same key are enqueued in a List.
Author:
Andrea Vacondio
  • Constructor Details

    • ListValueMap

      public ListValueMap()
  • Method Details

    • clear

      public void clear()
      Removes all the elements form the map
    • put

      public List<V> put(K key, V value)
      Adds the input value to the List associated to the input key
      Parameters:
      key -
      value -
      Returns:
      the List with the input value added
    • remove

      public boolean remove(K key, V value)
      Removes the input value from the List associated to the input key.
      Parameters:
      key -
      value -
      Returns:
      true if the value was found and removed.
    • get

      public List<V> get(K key)
      A null safe getter for the given key.
      Parameters:
      key -
      Returns:
      the list associated to the input key or an empty list of nothing is associated.
    • size

      public int size()
      Returns:
      number of values stored by this map