edu.berkeley.guir.lib.collection
Class WeakHashSet
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractSet
|
+--edu.berkeley.guir.lib.collection.WeakHashSet
- All Implemented Interfaces:
- Cloneable, Collection, Serializable, Set
- public class WeakHashSet
- extends AbstractSet
- implements Set, Cloneable, Serializable
Like a WeakHashMap, except that it's a set.
I've found this class to be useful when implementing circularly-referenced
objects. The reason is that you want to be able to notify a bunch of
objects, which means you need to have a reference to the objects. However,
you don't want the notified objects to hang around if you are the only
object to have a reference to them. Hence a weak reference, or more
specifically, a set of weak references.
This software is distributed under the
Berkeley Software License.
Revisions: - GUIRLib-v1.0-1.0.0, Dec 08 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
- Since:
- JDK 1.2
- Version:
- GUIRLib-v1.4-1.0.0, Aug 31 2000
- Author:
- (jasonh@cs.berkeley.edu)
- See Also:
- Serialized Form
WeakHashSet
public WeakHashSet()
add
public boolean add(Object obj)
- Specified by:
add
in interface Set
- Overrides:
add
in class AbstractCollection
remove
public boolean remove(Object obj)
- Specified by:
remove
in interface Set
- Overrides:
remove
in class AbstractCollection
clear
public void clear()
- Specified by:
clear
in interface Set
- Overrides:
clear
in class AbstractCollection
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Set
- Overrides:
isEmpty
in class AbstractCollection
size
public int size()
- Specified by:
size
in interface Set
- Overrides:
size
in class AbstractCollection
contains
public boolean contains(Object obj)
- Specified by:
contains
in interface Set
- Overrides:
contains
in class AbstractCollection
iterator
public Iterator iterator()
- Specified by:
iterator
in interface Set
- Overrides:
iterator
in class AbstractCollection
clone
public Object clone()
- Make a shallow clone.
- Overrides:
clone
in class Object