Save This Page
Home » jboss-5.0.0.CR1-src » org » jboss » util » collection » [javadoc | source]
org.jboss.util.collection
public class: WeakSet [javadoc | source]
java.lang.Object
   java.util.AbstractCollection
      java.util.AbstractSet
         org.jboss.util.collection.WeakSet

All Implemented Interfaces:
    Set, Collection

A Set implementation with weak elements. An entry in a WeakSet will automatically be removed when the element is no longer in ordinary use. More precisely, the presence of an given element will not prevent the element from being discarded by the garbage collector, that is, made finalizable, finalized, and then reclaimed.
Field Summary
protected final  ReferenceQueue queue    The reference queue used to get object removal notifications. 
protected final  Set set    The Set which will be used for element storage. 
Constructor:
 public WeakSet() 
 public WeakSet(Set set) 
    Construct a WeakSet. Any elements in the given set will be wrapped in WeakObject references.
    Parameters:
    set - The Set which will be used for element storage.
    Throws:
    NullArgumentException - Set is null.
Method from org.jboss.util.collection.WeakSet Summary:
add,   clear,   clone,   contains,   isEmpty,   iterator,   maintain,   remove,   size
Methods from java.util.AbstractSet:
equals,   hashCode,   removeAll
Methods from java.util.AbstractCollection:
add,   addAll,   clear,   contains,   containsAll,   isEmpty,   iterator,   remove,   removeAll,   retainAll,   size,   toArray,   toArray,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jboss.util.collection.WeakSet Detail:
 public boolean add(Object obj) 
    Add an element to the set.
 public  void clear() 
    Removes all of the elements from this set.
 public Object clone() 
    Returns a shallow copy of this WeakSet instance: the elements themselves are not cloned.
 public boolean contains(Object obj) 
    Returns true if this set contains the specified element.
 public boolean isEmpty() 
    Returns true if this set contains no elements.
 public Iterator iterator() 
    Return an iteration over the elements in the set.
 protected final  void maintain() 
    Maintain the elements in the set. Removes objects from the set that have been reclaimed due to GC.
 public boolean remove(Object obj) 
    Removes the given element from this set if it is present.
 public int size() 
    Return the size of the set.