|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet
org.jboss.util.collection.WeakSet
public class WeakSet
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 ReferenceQueue |
queue
The reference queue used to get object removal notifications. |
protected Set |
set
The Set which will be used for element storage. |
Constructor Summary | |
---|---|
WeakSet()
Construct a WeakSet based on a HashSet. |
|
WeakSet(Set set)
Construct a WeakSet. |
Method Summary | |
---|---|
boolean |
add(Object obj)
Add an element to the set. |
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 obj)
Returns true if this set contains the specified element. |
boolean |
isEmpty()
Returns true if this set contains no elements. |
Iterator |
iterator()
Return an iteration over the elements in the set. |
protected void |
maintain()
Maintain the elements in the set. |
boolean |
remove(Object obj)
Removes the given element from this set if it is present. |
int |
size()
Return the size of the set. |
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 |
Field Detail |
---|
protected final ReferenceQueue queue
protected final Set set
Constructor Detail |
---|
public WeakSet(Set set)
WeakObject
references.
set
- The Set which will be used for element storage.
NullArgumentException
- Set is null.public WeakSet()
Method Detail |
---|
protected final void maintain()
public int size()
size
in interface Collection
size
in interface Set
size
in class AbstractCollection
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface Set
iterator
in class AbstractCollection
public boolean add(Object obj)
add
in interface Collection
add
in interface Set
add
in class AbstractCollection
obj
- Element to add to the set.
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface Set
isEmpty
in class AbstractCollection
public boolean contains(Object obj)
contains
in interface Collection
contains
in interface Set
contains
in class AbstractCollection
obj
- Element whose presence in this set is to be tested.
public boolean remove(Object obj)
remove
in interface Collection
remove
in interface Set
remove
in class AbstractCollection
obj
- Object to be removed from this set, if present.
public void clear()
clear
in interface Collection
clear
in interface Set
clear
in class AbstractCollection
public Object clone()
clone
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |