Class TreeMultiset<A>

java.lang.Object
eu.bandm.tools.util.multi.AbstractMultiset<A>
eu.bandm.tools.util.multi.TreeMultiset<A>
Type Parameters:
A - type of the contained elements
All Implemented Interfaces:
Multiset<A>, SortedMultiset<A>, Serializable, Iterable<A>

public class TreeMultiset<A> extends AbstractMultiset<A> implements SortedMultiset<A>
Implementation using ordering. The ordering can be given explicitly by a comparator, or be the natural ordering.
See Also:
  • Constructor Details

    • TreeMultiset

      public TreeMultiset()
      Construct an empty set and use the natural ordering.
    • TreeMultiset

      public TreeMultiset(@Opt @Opt Comparator<? super A> comparator)
      Construct an empty set and use the given comparator.
      Parameters:
      comparator - to use for sorting. Can be null for natural ordering.
    • TreeMultiset

      public TreeMultiset(Multiset<? extends A> proto)
      Construct a new set which contains all given elements. Both collections are independent, changes will not be reflected mutually.
      Parameters:
      proto - the set giving the initial contents
  • Method Details

    • map

      protected SortedMap<A,Integer> map()
      Returns the supporting map. That map Realizes containment by mapping every contained object to a number greater than zero, how often it is contained in this instance.
      Specified by:
      map in class AbstractMultiset<A>
      Returns:
      the supporting map.
    • comparator

      public Comparator<? super A> comparator()
      Description copied from interface: SortedMultiset
      Deliver the comparator on the elements.
      Specified by:
      comparator in interface SortedMultiset<A>
      Returns:
      the comparator on the elements.