Class SortedMultiMap<K,​V>

  • Type Parameters:
    K - Key type
    V - Value type
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<K,​java.util.List<V>>

    public class SortedMultiMap<K,​V>
    extends java.util.HashMap<K,​java.util.List<V>>
    Map that allows you to partition values into lists according to a common key, and then convert those lists into an iterator of sorted arrays.
    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
      SortedMultiMap()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Iterator<V[]> arrays​(java.util.Comparator<V> comparator)  
      void putMulti​(K key, V value)  
      static <V> java.util.Iterator<V[]> singletonArrayIterator​(java.util.Comparator<V> comparator, java.util.List<V> list)
      Shortcut method if the partition key is empty.
      • 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

      • SortedMultiMap

        public SortedMultiMap()
    • Method Detail

      • putMulti

        public void putMulti​(K key,
                             V value)
      • arrays

        public java.util.Iterator<V[]> arrays​(java.util.Comparator<V> comparator)
      • singletonArrayIterator

        public static <V> java.util.Iterator<V[]> singletonArrayIterator​(java.util.Comparator<V> comparator,
                                                                         java.util.List<V> list)
        Shortcut method if the partition key is empty. We know that we would end up with a map with just one entry, so save ourselves the trouble of all that hashing.