Class MultiMap<K,​V>

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

    public class MultiMap<K,​V>
    extends java.util.LinkedHashMap<K,​java.util.List<V>>
    implements java.util.Map<K,​java.util.List<V>>
    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>
    • Constructor Summary

      Constructors 
      Constructor Description
      MultiMap()  
      MultiMap​(boolean noduplicates)  
      MultiMap​(MultiMap<S,​T> other)  
      MultiMap​(java.lang.Class<K> keyClass, java.lang.Class<V> valueClass, boolean noduplicates)  
      MultiMap​(java.util.Map<S,​? extends java.util.List<T>> other)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(K key, V value)  
      boolean addAll​(java.util.Map<K,​? extends java.util.Collection<? extends V>> map)  
      boolean addAll​(K key, java.util.Collection<? extends V> value)  
      java.util.Iterator<V> all()  
      java.util.List<V> allValues()
      Return a collection with all values
      java.util.Map<K,​V> flatten()  
      static <T extends java.lang.Comparable<? super T>>
      java.lang.String
      format​(java.util.Map<T,​? extends java.util.Collection<?>> map)  
      java.util.Iterator<V> iterate​(K key)  
      (package private) static java.lang.String pad​(int i)  
      boolean removeAll​(K key, java.util.Collection<? extends V> value)  
      boolean removeValue​(K key, V value)  
      MultiMap<V,​K> transpose()  
      (package private) static java.lang.String vertical​(int padding, java.util.Collection<?> used)  
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
      • 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

        clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
    • Field Detail

      • noduplicates

        private final boolean noduplicates
      • keyClass

        private final java.lang.Class<?> keyClass
      • valueClass

        private final java.lang.Class<?> valueClass
    • Constructor Detail

      • MultiMap

        public MultiMap()
      • MultiMap

        public MultiMap​(boolean noduplicates)
      • MultiMap

        public MultiMap​(java.lang.Class<K> keyClass,
                        java.lang.Class<V> valueClass,
                        boolean noduplicates)
      • MultiMap

        public MultiMap​(java.util.Map<S,​? extends java.util.List<T>> other)
      • MultiMap

        public MultiMap​(MultiMap<S,​T> other)
    • Method Detail

      • add

        public boolean add​(K key,
                           V value)
      • addAll

        public boolean addAll​(K key,
                              java.util.Collection<? extends V> value)
      • addAll

        public boolean addAll​(java.util.Map<K,​? extends java.util.Collection<? extends V>> map)
      • removeValue

        public boolean removeValue​(K key,
                                   V value)
      • removeAll

        public boolean removeAll​(K key,
                                 java.util.Collection<? extends V> value)
      • iterate

        public java.util.Iterator<V> iterate​(K key)
      • all

        public java.util.Iterator<V> all()
      • flatten

        public java.util.Map<K,​V> flatten()
      • allValues

        public java.util.List<V> allValues()
        Return a collection with all values
        Returns:
        all values
      • format

        public static <T extends java.lang.Comparable<? super T>> java.lang.String format​(java.util.Map<T,​? extends java.util.Collection<?>> map)
      • vertical

        static java.lang.String vertical​(int padding,
                                         java.util.Collection<?> used)
      • pad

        static java.lang.String pad​(int i)