|
|||||||||
| 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.Collectionsize in class java.util.AbstractCollectionpublic int count(java.lang.Object o)
count in interface Multisetcount in class AbstractMultisetpublic boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in class java.util.AbstractCollectionpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in class java.util.AbstractCollectionpublic void clear()
clear in interface java.util.Collectionclear in class java.util.AbstractCollectionpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in class java.util.AbstractCollectionpublic java.util.Set entrySet()
entrySet in interface MultisetentrySet in class AbstractMultisetpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||