Implements a HashSet where the objects given are stored in weak references.
Uses the WeakHashMap class as a backing store to implement a set of objects that are
stored as weak references. All information concerning using keys in the WeakHashMap
class pertain to this class and it is reccomended that the user of this class review
that material before using the class.
Because this set contains only weak references, it is not serializable. If one tried
to serialize a weak reference, the results would be highly unpredictable as the
object could likely vanish from memory before the proces was even completed. Users of
this class must use transient when the containing class uses this set.
Because of the semantics of the weak references, the value null is not allowed in this
set.
This collection is not identity based but equality based. This can cause some
confusion as you cannot put in two objects whose equals() methods return
true. It also means that an object being held is not necessarily the same one that
the user is holding. For example, you could have a String with the value 'fred' at
memory location X and ther could be another String with the value 'fred' at memory
location Y. The first instance is in the set but the second isn't.
author: Robert Simmons jr. version: $Revision: 1.1 $ See Also: java.lang.util.WeakHashMap See Also: java.lang.ref.WeakReference |