Class SmallMap<K,V>

java.lang.Object
org.jjazz.utilities.api.SmallMap<K,V>
Type Parameters:
K -
V -
All Implemented Interfaces:
Serializable

public class SmallMap<K,V> extends Object implements Serializable
A silly but fast map for small maps, based on simple ArrayLists and iterative search.
See Also:
  • Constructor Details

    • SmallMap

      public SmallMap()
      Create an empty SillyMap.
    • SmallMap

      public SmallMap(K key, V value)
      Create a SillyMap initialized with a single key/value pair.
      Parameters:
      key -
      value -
  • Method Details

    • clear

      public void clear()
    • clone

      public SmallMap<K,V> clone()
      Returns:
      A shallow copy of this map.
    • getKeys

      public List<K> getKeys()
    • getValues

      public List<V> getValues()
    • putValue

      public void putValue(K key, V value)
      Store value associated to key, replacing existing value if key already present in the map.
      Parameters:
      key -
      value -
    • remove

      public void remove(K key)
    • getValue

      public V getValue(K key)
      Parameters:
      key - K
      Returns:
      V Null if not found.
    • getKey

      public K getKey(V value)
      Parameters:
      value - V
      Returns:
      K Null if not found
    • isEmpty

      public boolean isEmpty()
    • size

      public int size()
    • toString

      public String toString()
      Overrides:
      toString in class Object