Multiset which maintains the ordering of its elements, according to either their
natural order or an explicit Comparator. This order is reflected when iterating over the
sorted multiset, either directly, or through its elementSet or entrySet views. In
all cases, this implementation uses Comparable#compareTo or Comparator#compare
instead of Object#equals to determine equivalence of instances.Warning
The comparison must be consistent with equals as explained by the
Comparable class specification. Otherwise, the resulting multiset will violate the Collection contract, which is specified in terms of Object#equals.
See the Guava User Guide article on Multiset.
| Modifier and Type | Method and Description |
|---|---|
| public Comparator | comparator()
Redeclares com. Ordering#natural() if the natural
ordering of the elements is used.
|
| public SortedMultiset | |
| public NavigableSet | elementSet()
Redeclares com. NavigableSet view of the distinct elements in this multiset.
|
| public Set | entrySet()
Redeclares com. Multiset.Entry instances,
each providing an element of the multiset and the count of that element.
|
| public Multiset. | firstEntry()
Returns the entry of the first element in this multiset, or |
| public SortedMultiset | headMultiset(E upperBound, BoundType boundType)
Returns a view of this multiset restricted to the elements less than |
| public Iterator | iterator()
Redeclares com. T.
|
| public Multiset. | lastEntry()
Returns the entry of the last element in this multiset, or |
| public Multiset. | pollFirstEntry()
Returns and removes the entry associated with the lowest element in this multiset, or returns
|
| public Multiset. | pollLastEntry()
Returns and removes the entry associated with the greatest element in this multiset, or returns
|
| public SortedMultiset | subMultiset(E lowerBound, BoundType lowerBoundType, E upperBound, BoundType upperBoundType)
Returns a view of this multiset restricted to the range between |
| public SortedMultiset | tailMultiset(E lowerBound, BoundType boundType)
Returns a view of this multiset restricted to the elements greater than |
| comparator | back to summary |
|---|---|
| public Comparator Redeclares com. Returns the comparator that orders this multiset, or
| |
| descendingMultiset | back to summary |
|---|---|
| public SortedMultiset Returns a descending view of this multiset. Modifications made to either map will be reflected in the other. | |
| elementSet | back to summary |
|---|---|
| public NavigableSet Redeclares com. Returns a
| |
| entrySet | back to summary |
|---|---|
| public Set Redeclares com. Doc from com. Returns a view of the contents of this multiset, grouped into The entry set is backed by the same data as the multiset, so any change to either is
immediately reflected in the other. However, multiset changes may or may not be reflected in
any The | |
| firstEntry | back to summary |
|---|---|
| public Multiset. Returns the entry of the first element in this multiset, or
| |
| headMultiset | back to summary |
|---|---|
| public SortedMultiset Returns a view of this multiset restricted to the elements less than The returned multiset will throw an | |
| iterator | back to summary |
|---|---|
| public Iterator Redeclares com. Doc from com. Returns an iterator over elements of type The iterator returns the elements in ascending order according to this multiset's comparator.
| |
| lastEntry | back to summary |
|---|---|
| public Multiset. Returns the entry of the last element in this multiset, or
| |
| pollFirstEntry | back to summary |
|---|---|
| public Multiset. Returns and removes the entry associated with the lowest element in this multiset, or returns
| |
| pollLastEntry | back to summary |
|---|---|
| public Multiset. Returns and removes the entry associated with the greatest element in this multiset, or returns
| |
| subMultiset | back to summary |
|---|---|
| public SortedMultiset Returns a view of this multiset restricted to the range between The returned multiset will throw an This method is equivalent to | |
| tailMultiset | back to summary |
|---|---|
| public SortedMultiset Returns a view of this multiset restricted to the elements greater than The returned multiset will throw an | |