Class MultiMap<K,V>

java.lang.Object
org.compiere.model.MultiMap<K,V>
Type Parameters:
K - Key
V - Value
All Implemented Interfaces:
Serializable, Map<K,V>

public final class MultiMap<K,V> extends Object implements Map<K,V>, Serializable
MultiMap allows multiple keys with their values. It accepts null values as keys and values. (implemented as two array lists)
Version:
$Id: MultiMap.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Constructor Details

    • MultiMap

      public MultiMap()
      Constructor with 10 initial Capacity (same as ArrayList)
    • MultiMap

      public MultiMap(int initialCapacity)
      Constructor
      Parameters:
      initialCapacity - initial capacity
  • Method Details

    • size

      public int size()
      Get number of elements
      Specified by:
      size in interface Map<K,V>
      Returns:
      size
    • isEmpty

      public boolean isEmpty()
      Is Empty
      Specified by:
      isEmpty in interface Map<K,V>
      Returns:
      true if empty
    • containsKey

      public boolean containsKey(Object key)
      Contains Key
      Specified by:
      containsKey in interface Map<K,V>
      Parameters:
      key - key value
      Returns:
      true if key exist
    • containsValue

      public boolean containsValue(Object value)
      Contains Value
      Specified by:
      containsValue in interface Map<K,V>
      Parameters:
      value - element value
      Returns:
      true if value exists
    • get

      public V get(Object key)
      Get ArrayList of Values of Key
      Specified by:
      get in interface Map<K,V>
      Parameters:
      key - key
      Returns:
      value
    • getValues

      public ArrayList<V> getValues(Object key)
      Get ArrayList of Values of Key
      Parameters:
      key - key
      Returns:
      array list of values
    • getKeys

      public ArrayList<K> getKeys(Object value)
      Get ArrayList of Keys with Value
      Parameters:
      value - value
      Returns:
      array list of keys
    • put

      public V put(K key, V value)
      Put Key and Value
      Specified by:
      put in interface Map<K,V>
      Parameters:
      key -
      value -
      Returns:
      always null
    • remove

      public V remove(Object key)
      Remove key
      Specified by:
      remove in interface Map<K,V>
      Parameters:
      key - key
      Returns:
      removed value
    • putAll

      public void putAll(Map<? extends K,? extends V> t)
      Put all
      Specified by:
      putAll in interface Map<K,V>
      Parameters:
      t -
    • clear

      public void clear()
      Clear content
      Specified by:
      clear in interface Map<K,V>
    • keySet

      public Set<K> keySet()
      Return HashSet of Keys
      Specified by:
      keySet in interface Map<K,V>
      Returns:
      key set
    • values

      public Collection<V> values()
      Return Collection of values
      Specified by:
      values in interface Map<K,V>
      Returns:
      values
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Get entry set - not implemented
      Specified by:
      entrySet in interface Map<K,V>
      Returns:
      entry set
    • equals

      public boolean equals(Object o)
      Equals - not implemented
      Specified by:
      equals in interface Map<K,V>
      Overrides:
      equals in class Object
      Parameters:
      o - test object
      Returns:
      true if equal
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<K,V>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns class name and number of entries
      Overrides:
      toString in class Object
      Returns:
      info
    • printToLog

      public void printToLog()
      dump all keys - values to log