|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Multiset
A multiset is like a set, except that it can include multiple copies of an element. It differs from a list in that the element occurrences are not in any order. Formally, a multiset consists of a set S and a function m(x) that maps each element x of S to the number of times it occurs in the multiset.
The Multiset interface extends the Collection interface, adding methods for getting the number of distinct elements and the number of times a given element occurs in the multiset. Its size() method returns the sum of the occurrence counts of all the elements. The iterator returned by the iterator() method on a multiset may return multiple copies of the same element. To get an iterator over the distinct elements, use distinctIterator().
| Nested Class Summary | |
|---|---|
static interface |
Multiset.Entry
Interface for objects that represent entries in a multiset. |
| Method Summary | |
|---|---|
int |
count(java.lang.Object o)
Returns the number of occurrences of the given element in this multiset. |
java.util.Set |
entrySet()
Returns the set of entries in the multiset. |
| Methods inherited from interface java.util.Collection |
|---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Method Detail |
|---|
int count(java.lang.Object o)
java.util.Set entrySet()
The returned set supports element removal: removing an entry
corresponds to deleting all occurrences of the corresponding element
from the multiset. However, the returned set does not support
the add or addAll methods.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||