Interface Multiset<E>
-
- Type Parameters:
E- the element type
- All Superinterfaces:
java.util.Collection<E>,java.lang.Iterable<E>
- All Known Implementing Classes:
HashMultiset
public interface Multiset<E> extends java.util.Collection<E>A collection which permits duplicates, and provides methods adding/removing several counts of an element.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadd(E element, int n)Add n counts of an element.intcount(java.lang.Object element)java.util.Set<E>getDistinctElements()intremove(java.lang.Object element, int n)Remove up to n counts of an element.
-
-
-
Method Detail
-
add
void add(E element, int n)
Add n counts of an element.- Parameters:
element- the element to addn- how many to add
-
remove
int remove(java.lang.Object element, int n)Remove up to n counts of an element.- Parameters:
element- the element the removen- how many to remove- Returns:
- the number of elements removed
-
count
int count(java.lang.Object element)
-
getDistinctElements
java.util.Set<E> getDistinctElements()
-
-