|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
common.AbstractMultiset
common.HashMultiset
public class HashMultiset
An implementation of the Multiset interface that uses a HashMap from elements to integers as the underlying data structure.
Constructor Summary | |
---|---|
HashMultiset()
Creates an empty HashMultiset. |
|
HashMultiset(java.util.Collection c)
Creates a HashMultiset with the same multiset of elements as the given Collection. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
Adds a single copy of the given element to this multiset. |
void |
clear()
Removes all elements from this multiset. |
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. |
java.util.Iterator |
iterator()
Returns an iterator over this multiset. |
static void |
main(java.lang.String[] args)
Test program |
boolean |
remove(java.lang.Object o)
Removes a single copy of the given element from this multiset, if such an element is present. |
int |
size()
Returns the sum of the occurrence counts of all items. |
Methods inherited from class common.AbstractMultiset |
---|
contains, equals, hashCode |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public HashMultiset()
public HashMultiset(java.util.Collection c)
Method Detail |
---|
public int size()
size
in interface java.util.Collection
size
in class java.util.AbstractCollection
public int count(java.lang.Object o)
count
in interface Multiset
count
in class AbstractMultiset
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in class java.util.AbstractCollection
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in class java.util.AbstractCollection
public void clear()
clear
in interface java.util.Collection
clear
in class java.util.AbstractCollection
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in class java.util.AbstractCollection
public java.util.Set entrySet()
entrySet
in interface Multiset
entrySet
in class AbstractMultiset
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |