public class WeakSet
extends java.util.AbstractSet
implements java.io.Serializable, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.ref.ReferenceQueue |
queue
The reference queue used to get object removal notifications.
|
protected java.util.Set |
serialized_set |
protected java.util.Set |
set
The set which will be used for element storage.
|
| Constructor and Description |
|---|
WeakSet()
Construct a WeakSet based on a HashSet.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.lang.Object obj)
Add an element to the set.
|
void |
clear()
Removes all of the elements from this set.
|
java.lang.Object |
clone()
Returns a shallow copy of this WeakSet instance: the elements themselves are not cloned.
|
boolean |
contains(java.lang.Object obj)
Returns true if this set contains the specified element.
|
protected void |
expungeStaleEntries()
Remove garbage collected entries.
|
boolean |
isEmpty()
Returns true if this set contains no elements.
|
java.util.Iterator |
iterator()
Return an iteration over the elements in the set.
|
protected java.lang.Object |
readResolve()
Perform special handling on serialization.
|
boolean |
remove(java.lang.Object obj)
Removes the given element from this set if it is present.
|
int |
size()
Return the size of the set.
|
java.lang.Object[] |
toArray()
Convert the set to an array.
|
java.lang.Object[] |
toArray(java.lang.Object[] result)
Convert the set to an array.
|
protected java.lang.Object |
writeReplace()
Perform special handling on serialization.
|
protected transient java.util.Set set
protected transient java.lang.ref.ReferenceQueue queue
protected java.util.Set serialized_set
public int size()
size in interface java.util.Collectionsize in interface java.util.Setsize in class java.util.AbstractCollectionpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Setiterator in class java.util.AbstractCollectionpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.SettoArray in class java.util.AbstractCollectionpublic java.lang.Object[] toArray(java.lang.Object[] result)
toArray in interface java.util.CollectiontoArray in interface java.util.SettoArray in class java.util.AbstractCollectionpublic boolean add(java.lang.Object obj)
add in interface java.util.Collectionadd in interface java.util.Setadd in class java.util.AbstractCollectionobj - Element to add to the set.public boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.SetisEmpty in class java.util.AbstractCollectionpublic boolean contains(java.lang.Object obj)
contains in interface java.util.Collectioncontains in interface java.util.Setcontains in class java.util.AbstractCollectionobj - Element whose presence in this set is to be tested.public boolean remove(java.lang.Object obj)
remove in interface java.util.Collectionremove in interface java.util.Setremove in class java.util.AbstractCollectionobj - Object to be removed from this set, if present.public void clear()
clear in interface java.util.Collectionclear in interface java.util.Setclear in class java.util.AbstractCollectionpublic java.lang.Object clone()
clone in class java.lang.Objectprotected final void expungeStaleEntries()
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException
java.io.ObjectStreamExceptionprotected java.lang.Object readResolve()
throws java.io.ObjectStreamException
java.io.ObjectStreamException