Package eu.bandm.tools.util.multi
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>
Implementation using ordering.
The ordering can be given explicitly by a comparator,
or be the natural ordering.
- See Also:
-
Field Summary
Fields inherited from interface eu.bandm.tools.util.multi.Multiset
DEFAULT_MULTI_FORMAT_STRING, DEFAULT_SINGLE_FORMAT_STRING
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty set and use the natural ordering.TreeMultiset
(Multiset<? extends A> proto) Construct a new set which contains all given elements.TreeMultiset
(@Opt Comparator<? super A> comparator) Construct an empty set and use the given comparator. -
Method Summary
Modifier and TypeMethodDescriptionComparator
<? super A> Deliver the comparator on the elements.map()
Returns the supporting map.Methods inherited from class eu.bandm.tools.util.multi.AbstractMultiset
add, add, clear, contains, containsUnchecked, count, countAll, countAllUnchecked, countUnchecked, domain, isEmpty, iterator, remove, removeAll, removeAllUnchecked, removeDomain, removeDomainUnchecked, removeUnchecked, retainAll, retainAllUnchecked, supportMap, toString, xget
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface eu.bandm.tools.util.multi.Multiset
add, add, addAll, clear, contains, containsUnchecked, count, countAll, countAllUnchecked, countUnchecked, domain, isEmpty, remove, removeAll, removeAllUnchecked, removeDomain, removeDomainUnchecked, removeUnchecked, retainAll, retainAllUnchecked, supportMap, toString, toString
-
Constructor Details
-
TreeMultiset
public TreeMultiset()Construct an empty set and use the natural ordering. -
TreeMultiset
Construct an empty set and use the given comparator.- Parameters:
comparator
- to use for sorting. Can be null for natural ordering.
-
TreeMultiset
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
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 classAbstractMultiset<A>
- Returns:
- the supporting map.
-
comparator
Description copied from interface:SortedMultiset
Deliver the comparator on the elements.- Specified by:
comparator
in interfaceSortedMultiset<A>
- Returns:
- the comparator on the elements.
-