T - the class of the elements of this multi-set.public final class TreeMultiSet<T> extends AbstractMultiSet<NavigableMap<T,MultiSet.Multiplicity>,T> implements SortedMultiSet<T>
TreeMap.
Mathematically this is something between a set and a family.
Note that this kind of set does not support null elements.AbstractMultiSet.MultiplicityImpl, AbstractMultiSet.MultiSetIteratorImpl<T>MultiSet.Multiplicityobj2mult| Modifier | Constructor and Description |
|---|---|
|
TreeMultiSet()
Creates a new, empty
MultiSet. |
|
TreeMultiSet(Comparator<? super T> comp)
Creates a new, empty
MultiSet. |
|
TreeMultiSet(MultiSet<? extends T> other)
Copy constructor.
|
private |
TreeMultiSet(NavigableMap<T,MultiSet.Multiplicity> t2mult) |
|
TreeMultiSet(Set<? extends T> sSet)
Creates a multi set with the elements of
sSet
and all elements with multiplicity 1. |
| Modifier and Type | Method and Description |
|---|---|
Comparator<? super T> |
comparator()
Returns the comparator used to order the elements in this set,
or
null
if this set uses the natural ordering of its elements. |
T |
first()
Returns the first (lowest) element currently in this set.
|
NavigableMap<T,MultiSet.Multiplicity> |
getMap()
Returns a view of the underlying map of this
SortedMultiSet
as a map mapping each entry to its multiplicity. |
SortedSet<T> |
getSet()
Returns a view of the underlying set of this
MultiSet. |
SortedMultiSet<T> |
headSet(T toElement)
Returns a view of the portion of this multi-set
whose elements are strictly less than
toElement. |
T |
last()
Returns the last (highest) element currently in this set.
|
SortedMultiSet<T> |
subSet(T fromElement,
T toElement)
Returns a view of the portion of this multi-set
whose elements range from
fromElement inclusively
to toElement exclusively. |
SortedMultiSet<T> |
tailSet(T fromElement)
Returns a view of the portion of this multi-set
whose elements are greater than or equal to
fromElement. |
String |
toString() |
add, addAll, addAll, addWithMult, addWithMult, clear, contains, containsAll, equals, getMaxMult, getMultiplicity, getMultiplicityObj, getObjWithMaxMult, getSetWithMults, hashCode, isEmpty, iterator, remove, removeAll, removeWithMult, removeWithMult, retainAll, setMultiplicity, size, sizeWithMult, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, addAll, addAll, addWithMult, addWithMult, clear, contains, containsAll, equals, getMaxMult, getMultiplicity, getMultiplicityObj, getObjWithMaxMult, getSetWithMults, hashCode, isEmpty, iterator, remove, removeAll, removeWithMult, removeWithMult, retainAll, setMultiplicity, size, sizeWithMult, toArray, toArrayforEach, spliteratorprivate TreeMultiSet(NavigableMap<T,MultiSet.Multiplicity> t2mult)
public TreeMultiSet()
MultiSet.public TreeMultiSet(Comparator<? super T> comp)
MultiSet.public TreeMultiSet(MultiSet<? extends T> other)
other - another MultiSet instance.public Comparator<? super T> comparator()
null
if this set uses the natural ordering of its elements.comparator in interface SortedMultiSet<T>null
if this set uses the natural ordering of its elements.public T first()
first in interface SortedMultiSet<T>NoSuchElementException - if this set is empty.public T last()
last in interface SortedMultiSet<T>NoSuchElementException - if this set is empty.public SortedMultiSet<T> headSet(T toElement)
toElement.
The returned multi-set is backed by this multi-set,
so changes in the returned set are reflected in this multi-set,
and vice-versa.
The returned multi-set supports all optional multi-set operations
that this multi-set supports.
The returned multi-set
will throw an IllegalArgumentException
on an attempt to insert an element outside its range.
headSet in interface SortedMultiSet<T>toElement - high endpoint (exclusive) of the returned multi-set.toElement.ClassCastException - if toElement is not compatible
with this multi-set's comparator
(or, if the set has no comparator,
if toElement does not implement Comparable).
Implementations may, but are not required to,
throw this exception if toElement cannot be compared
to elements currently in this multi-set.NullPointerException - if toElement is null
and this multi-set does not permit null elements.IllegalArgumentException - if this multi-set itself has a restricted range,
and toElement lies outside the bounds of the range.public SortedMultiSet<T> tailSet(T fromElement)
fromElement.
The returned multi-set is backed by this multi-set,
so changes in the returned set are reflected in this multi-set,
and vice-versa.
The returned multi-set supports all optional multi-set operations
that this multi-set supports.
The returned multi-set
will throw an IllegalArgumentException
on an attempt to insert an element outside its range.
tailSet in interface SortedMultiSet<T>fromElement - low endpoint (inclusive) of the returned multi-set.fromElement.ClassCastException - if fromElement is not compatible
with this multi-set's comparator
(or, if the set has no comparator,
if fromElement does not implement Comparable).
Implementations may, but are not required to,
throw this exception if fromElement cannot be compared
to elements currently in this multi-set.NullPointerException - if fromElement is null
and this multi-set does not permit null elements.IllegalArgumentException - if this multi-set itself has a restricted range,
and fromElement lies outside the bounds of the range.public SortedMultiSet<T> subSet(T fromElement, T toElement)
fromElement inclusively
to toElement exclusively.
The returned multi-set is backed by this multi-set,
so changes in the returned set are reflected in this multi-set,
and vice-versa.
The returned multi-set supports all optional multi-set operations
that this multi-set supports.
The returned multi-set
will throw an IllegalArgumentException
on an attempt to insert an element outside its range.
subSet in interface SortedMultiSet<T>fromElement - low endpoint (inclusive) of the returned multi-set.toElement - high endpoint (exclusive) of the returned multi-set.fromElement inclusively
to toElement exclusively.ClassCastException - **** maybe original documentation wrong. ****
if fromElement and toElement
cannot be compared to one another using this set's comparator
(or, if the set has no comparator, using natural ordering).
or if fromElement is not compatible
with this multi-set's comparator
(or, if the set has no comparator,
if fromElement does not implement Comparable).
Implementations may, but are not required to,
throw this exception
if fromElement or toElement
cannot be compared to elements currently in this multi-set.NullPointerException - if fromElement or toElement
is null
and this multi-set does not permit null elements.IllegalArgumentException - if fromElement is greater than toElement
or if this multi-set itself has a restricted range,
and fromElement or toElement
lies outside the bounds of the range.public SortedSet<T> getSet()
MultiSet.
For certain implementations, this set is immutable
to prevent implicit modification of this MultiSet.public NavigableMap<T,MultiSet.Multiplicity> getMap()
SortedMultiSet
as a map mapping each entry to its multiplicity.Copyright © 2012–2018 Simuline Organization (l2r). All rights reserved.