|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Multiset<T>
A set-like collection that allows multiple instances of a value to be represented in the collection.
| Method Summary | ||
|---|---|---|
boolean |
add(T val)
Add a single instance of val to the multiset. |
|
boolean |
add(T val,
int instances)
Add the given number of instances of val to the multiset. |
|
boolean |
addAll(Collection<? extends T> coll)
Add all the elements of coll to this multiset. |
|
PredicateSet<T> |
asSet()
Produce a set view of the multiset (with only one entry for each unique instance). |
|
void |
clear()
Remove all elements from the multiset |
|
boolean |
contains(Object obj)
Whether the multiset contains at least one instance of obj. |
|
boolean |
containsAll(Collection<?> c)
Whether each element of the collection appears at least once in this multiset. |
|
int |
count(Object value)
The number of times value appears in the multiset (if it does not appear,
the result is 0). |
|
boolean |
equals(Object obj)
Compares two multisets. |
|
boolean |
hasFixedSize()
Whether the multiset can change size. |
|
int |
hashCode()
A hash code for the multiset, computed by summing the hash codes of each element in the iterator. |
|
boolean |
isEmpty()
Whether the multiset is empty. |
|
boolean |
isInfinite()
Whether the iterator has an infinite number of elements. |
|
boolean |
isStatic()
Whether the multiset will always contain the same values. |
|
boolean |
isSupersetOf(Multiset<?> s)
Whether each element ( elt) of s appears at least s.count(elt) times
in this multiset. |
|
Iterator<T> |
iterator()
An iterator for the multiset. |
|
boolean |
remove(Object obj)
Remove a single instance of obj from the multiset, if one exists. |
|
boolean |
remove(Object obj,
int instances)
Remove the given number of instances of obj from the multiset. |
|
boolean |
removeAll(Collection<?> coll)
Remove all the elements of coll from this multiset. |
|
boolean |
removeAllInstances(Object obj)
Remove all instances of obj from the multiset |
|
boolean |
retainAll(Collection<?> coll)
Remove all the elements of this multiset except those contained in coll. |
|
int |
size()
The size of the multiset. |
|
int |
size(int bound)
The size of the multiset bounded by the given value. |
|
Object[] |
toArray()
Fill an array with the contents of the multiset. |
|
|
toArray(S[] fill)
Fill an array with the contents of the multiset. |
|
| Method Detail |
|---|
int size()
size in interface Collection<T>size in interface SizedIterable<T>int size(int bound)
size in interface SizedIterable<T>bound - Maximum result. Assumed to be nonnegative.boolean isInfinite()
isInfinite in interface SizedIterable<T>boolean hasFixedSize()
hasFixedSize in interface SizedIterable<T>boolean isStatic()
isStatic in interface SizedIterable<T>boolean isEmpty()
isEmpty in interface Collection<T>isEmpty in interface SizedIterable<T>boolean contains(Object obj)
obj.
contains in interface Collection<T>int count(Object value)
value appears in the multiset (if it does not appear,
the result is 0). If the number is too large, Integer.MAX_VALUE may
be returned.
PredicateSet<T> asSet()
Iterator<T> iterator()
n instances of a
value, that value will appear n times during iteration. Invoking
remove on the iterator removes one instance.
iterator in interface Collection<T>iterator in interface Iterable<T>Object[] toArray()
toArray in interface Collection<T><S> S[] toArray(S[] fill)
toArray in interface Collection<T>boolean add(T val)
val to the multiset.
add in interface Collection<T>true (indicating that the multiset was modified)
boolean add(T val,
int instances)
val to the multiset.
true (indicating that the multiset was modified)boolean remove(Object obj)
obj from the multiset, if one exists.
remove in interface Collection<T>true iff the multiset was modified
boolean remove(Object obj,
int instances)
obj from the multiset. If
count(obj) <= instances, removes all instances of the given value.
true iff the multiset was modifiedboolean removeAllInstances(Object obj)
obj from the multiset
true iff the multiset was modifiedboolean containsAll(Collection<?> c)
containsAll in interface Collection<T>boolean isSupersetOf(Multiset<?> s)
elt) of s appears at least s.count(elt) times
in this multiset.
boolean addAll(Collection<? extends T> coll)
coll to this multiset. If the same value appears multiple
times in coll, it will appear multiple times in this multiset.
addAll in interface Collection<T>true iff the multiset was successfully modifiedboolean removeAll(Collection<?> coll)
coll from this multiset. If the same value appears
multiple times in coll, the same number of instances will be removed from
this multiset.
removeAll in interface Collection<T>true iff the multiset was modifiedboolean retainAll(Collection<?> coll)
coll. If
the same value appears multiple times in coll, at most that number of instances
will not be removed from this multiset.
retainAll in interface Collection<T>true iff the multiset was modifiedvoid clear()
clear in interface Collection<T>boolean equals(Object obj)
equals in interface Collection<T>equals in class Objecttrue iff obj is a multiset with the same elements as thisint hashCode()
0; each null element has hash code 1.)
hashCode in interface Collection<T>hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||