Class MultivalueHashMap<K,​V>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<K,​java.util.LinkedList<V>>

    public class MultivalueHashMap<K,​V>
    extends java.util.HashMap<K,​java.util.LinkedList<V>>
    A Hash that can hold multiple values for each key
    Author:
    pcingola
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(K key, java.util.Collection<V> values)
      Add multiple values
      void add​(K key, V value)
      Add a single value
      java.util.List<V> getOrCreate​(K key)
      Get a list of values (or create it if not available)
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • MultivalueHashMap

        public MultivalueHashMap()
    • Method Detail

      • add

        public void add​(K key,
                        java.util.Collection<V> values)
        Add multiple values
      • add

        public void add​(K key,
                        V value)
        Add a single value
      • getOrCreate

        public java.util.List<V> getOrCreate​(K key)
        Get a list of values (or create it if not available)