public class WeakSet extends AbstractSet implements Set
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
WeakSet()
Construct a WeakSet based on a HashSet.
|
WeakSet(Set set)
Construct a WeakSet.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
equals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringprotected final ReferenceQueue queue
protected final Set set
public WeakSet(Set set)
WeakObject references.set - The Set which will be used for element storage.NullArgumentException - Set is null.public WeakSet()
protected final void maintain()
public int size()
size in interface Collectionsize in interface Setsize in class AbstractCollectionpublic Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Setiterator in class AbstractCollectionpublic boolean add(Object obj)
add in interface Collectionadd in interface Setadd in class AbstractCollectionobj - Element to add to the set.public boolean isEmpty()
isEmpty in interface CollectionisEmpty in interface SetisEmpty in class AbstractCollectionpublic boolean contains(Object obj)
contains in interface Collectioncontains in interface Setcontains in class AbstractCollectionobj - Element whose presence in this set is to be tested.public boolean remove(Object obj)
remove in interface Collectionremove in interface Setremove in class AbstractCollectionobj - Object to be removed from this set, if present.public void clear()
clear in interface Collectionclear in interface Setclear in class AbstractCollectionCopyright © 2015 JBoss by Red Hat. All rights reserved.