|
||||||||||
| 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<T>
edu.rice.cs.plt.collect.WeakHashSet<T>
public class WeakHashSet<T>
A Set implementation that has similar semantics to WeakHashMap.
The elements in this set are weakly held, so when the element is not longer
strongly reachable, the element will be removed from the set.
| Constructor Summary | |
|---|---|
WeakHashSet()
Constructs a new WeakHashSet. |
|
| Method Summary | |
|---|---|
boolean |
add(T item)
Adds the given item to the set. |
void |
clear()
Removes all items from the set. |
boolean |
contains(Object o)
Returns a boolean value indicating whether the given object is a member of the set. |
Iterator<T> |
iterator()
Returns an iterator for the elements in the set. |
boolean |
remove(Object o)
Removes the given item from the set, if it was in the set. |
int |
size()
Returns the number of elements in the WeakHashSet. |
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
addAll, containsAll, isEmpty, retainAll, toArray, toArray |
| Constructor Detail |
|---|
public WeakHashSet()
WeakHashSet.
| Method Detail |
|---|
public int size()
WeakHashSet.
Initially, the WeakHashSet is empty, so size returns 0.
size in interface Collection<T>size in interface Set<T>size in class AbstractCollection<T>public boolean add(T item)
add in interface Collection<T>add in interface Set<T>add in class AbstractCollection<T>item - The item to add
true if the item was not already in the set, false otherwisepublic void clear()
clear,
size will return 0.
clear in interface Collection<T>clear in interface Set<T>clear in class AbstractCollection<T>public boolean contains(Object o)
contains in interface Collection<T>contains in interface Set<T>contains in class AbstractCollection<T>o - The object to look for
true if the object exists in the set, false otherwisepublic boolean remove(Object o)
remove in interface Collection<T>remove in interface Set<T>remove in class AbstractCollection<T>o - The item to remove
true if the item was in the set and has been removed, otherwise (when the item was not in the set) falsepublic Iterator<T> iterator()
null. The remove operation is
implemented.
iterator in interface Iterable<T>iterator in interface Collection<T>iterator in interface Set<T>iterator in class AbstractCollection<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||