|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.collection.HashBag
A bag collection backed by a HashMap.
This software is distributed under the Berkeley Software License.
Revisions: - GUIRLib-v1.0-1.0.0, Dec 07 1999, JH Created class - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH Touched for GUIRLib release - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH Touched for GUIRLib release - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH Touched for GUIRLib release
Constructor Summary | |
HashBag()
|
Method Summary | |
int |
add(Object obj)
|
void |
clear()
Clear out all elements in the bag. |
boolean |
contains(Object obj)
See if the bag contains the specified object. |
boolean |
isEmpty()
See if the bag is empty. |
boolean |
isEmpty(Object obj)
See if the bag contains any of this object. |
Iterator |
iterator()
Iterate over everything in the bag. |
Set |
keySet()
Get the set of elements. |
int |
remove(Object obj)
Remove an object from the bag. |
int |
size()
Get the total number of objects in the bag. |
int |
size(Object obj)
Get the number of instances of this object contained in the bag. |
int |
sizeKeySet()
Get the number of unique objects in the bag. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public HashBag()
Method Detail |
public int add(Object obj)
public void clear()
public boolean contains(Object obj)
public boolean isEmpty()
public boolean isEmpty(Object obj)
public Iterator iterator()
keySet()
and get the iterator from that.
This implementation gives a deferred ConcurrentModification exception if you modify the bag while iterating. That is, it won't throw the exception until you get to the next bunch of elements. For example, if you were iterating over the bag {'A'=4, 'B'=3}, modifying the bag won't throw an exception until you go from 'A' to 'B'.
public Set keySet()
public int remove(Object obj)
public int size()
public int sizeKeySet()
public int size(Object obj)
public String toString()
toString
in class Object
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |