org.apache.jdo.util
Class WeakHashSet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byjava.util.HashSet
              extended byorg.apache.jdo.util.WeakHashSet
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.io.Serializable, java.util.Set

public class WeakHashSet
extends java.util.HashSet

A weak HashSet. An element stored in the WeakHashSet might be garbage collected, if there is no strong reference to this element.

See Also:
Serialized Form

Constructor Summary
WeakHashSet()
           
 
Method Summary
 boolean add(java.lang.Object o)
          Adds the specified element to this set if it is not already present.
 boolean contains(java.lang.Object o)
          Returns true if this set contains the specified element.
 java.util.Iterator iterator()
          Returns an iterator over the elements in this set.
 boolean remove(java.lang.Object o)
          Removes the given element from this set if it is present.
 
Methods inherited from class java.util.HashSet
clear, clone, isEmpty, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

WeakHashSet

public WeakHashSet()
Method Detail

iterator

public java.util.Iterator iterator()
Returns an iterator over the elements in this set. The elements are returned in no particular order.

Returns:
an Iterator over the elements in this set.

contains

public boolean contains(java.lang.Object o)
Returns true if this set contains the specified element.

Parameters:
o - element whose presence in this set is to be tested.
Returns:
true if this set contains the specified element.

add

public boolean add(java.lang.Object o)
Adds the specified element to this set if it is not already present.

Parameters:
o - element to be added to this set.
Returns:
true if the set did not already contain the specified element.

remove

public boolean remove(java.lang.Object o)
Removes the given element from this set if it is present.

Parameters:
o - object to be removed from this set, if present.
Returns:
true if the set contained the specified element.


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.