org.openide.util
Class WeakSet

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractSet
              |
              +--org.openide.util.WeakSet
All Implemented Interfaces:
Cloneable, Collection, Serializable, Set

public class WeakSet
extends AbstractSet
implements Cloneable, Serializable

Set which holds its members by using of WeakReferences. MT level: unsafe.

See Also:
Serialized Form

Constructor Summary
WeakSet()
          Constructs a new set.
WeakSet(Collection c)
          Constructs a new set containing the elements in the specified collection.
WeakSet(int initialCapacity)
          Constructs a new, empty set;
WeakSet(int initialCapacity, float loadFactor)
          Constructs a new, empty set;
 
Method Summary
 boolean add(Object o)
          Adds the specified element to this set if it is not already present.
 void clear()
          Removes all of the elements from this set.
 Object clone()
          Returns a shallow copy of this WeakSet instance: the elements themselves are not cloned.
 boolean contains(Object o)
          Returns true if this set contains the specified element.
 boolean isEmpty()
          Returns true if this set contains no elements.
 Iterator iterator()
          Returns an iterator over the elements in this set.
 boolean remove(Object o)
          Removes the given element from this set if it is present.
 int size()
           
 Object[] toArray(Object[] array)
           
 String toString()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, retainAll, toArray
 

Constructor Detail

WeakSet

public WeakSet()
Constructs a new set.

WeakSet

public WeakSet(Collection c)
Constructs a new set containing the elements in the specified collection.
Parameters:
c - a collection to add

WeakSet

public WeakSet(int initialCapacity)
Constructs a new, empty set;
Parameters:
initial - capacity

WeakSet

public WeakSet(int initialCapacity,
               float loadFactor)
Constructs a new, empty set;
Parameters:
initialCapacity -  
loadFactor. -  
Method Detail

add

public boolean add(Object o)
Adds the specified element to this set if it is not already present.
Overrides:
add in class AbstractCollection
Parameters:
o - an Object to add

clear

public void clear()
Removes all of the elements from this set.
Overrides:
clear in class AbstractCollection

clone

public Object clone()
Returns a shallow copy of this WeakSet instance: the elements themselves are not cloned.
Overrides:
clone in class Object

contains

public boolean contains(Object o)
Returns true if this set contains the specified element.
Overrides:
contains in class AbstractCollection
Parameters:
o - an Object to examine

isEmpty

public boolean isEmpty()
Returns true if this set contains no elements.
Overrides:
isEmpty in class AbstractCollection

iterator

public Iterator iterator()
Returns an iterator over the elements in this set.
Overrides:
iterator in class AbstractCollection

remove

public boolean remove(Object o)
Removes the given element from this set if it is present.
Overrides:
remove in class AbstractCollection
Parameters:
o - an Object to remove
Returns:
true if and only if the Object was successfuly removed.

size

public int size()
Overrides:
size in class AbstractCollection
Returns:
the number of elements in this set (its cardinality).

toArray

public Object[] toArray(Object[] array)
Overrides:
toArray in class AbstractCollection

toString

public String toString()
Overrides:
toString in class AbstractCollection


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.