Class TreeSetMap<K,​V>

  • Type Parameters:
    K - The type of map key.
    V - The type of map value.
    All Implemented Interfaces:
    CollectionMap<K,​V,​java.util.Set<V>>, java.util.Map<K,​java.util.Set<V>>

    public class TreeSetMap<K,​V>
    extends AbstractDecoratorCollectionMap<K,​V,​java.util.Set<V>>
    An decorator map that stores a TreeSet of values for each key, with special methods for retrieving single values.
    Author:
    Garret Wilson
    • Constructor Detail

      • TreeSetMap

        public TreeSetMap​(java.util.Map<K,​java.util.Set<V>> map)
        Map constructor with a natural ordering of set values.
        Parameters:
        map - The map this map should decorate.
        Throws:
        java.lang.NullPointerException - if the provided map is null.
      • TreeSetMap

        public TreeSetMap​(java.util.Map<K,​java.util.Set<V>> map,
                          java.util.Comparator<? super V> comparator)
        Map and comparator constructor that sorts set values in the order specified by the comparator.
        Parameters:
        map - The map this map should decorate.
        comparator - The comparator that will be used to order the values in the set, or null if natural ordering should be used.
        Throws:
        java.lang.NullPointerException - if the provided map is null.
    • Method Detail

      • getComparator

        public java.util.Comparator<? super V> getComparator()
        Returns:
        The comparator that will be used to order the values in the set, or null if natural ordering should be used.
      • createCollection

        public java.util.Set<V> createCollection()
        Creates a collection in which to store values. This version returns a TreeSet.
        Returns:
        The collections with the values stored.