org.apache.jdo.util
Class WeakHashSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet
              extended by org.apache.jdo.util.WeakHashSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, 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.

Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Overrides:
iterator in class java.util.HashSet
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.

Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Overrides:
contains in class java.util.HashSet
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.

Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class java.util.HashSet
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.

Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Overrides:
remove in class java.util.HashSet
Parameters:
o - object to be removed from this set, if present.
Returns:
true if the set contained the specified element.


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