|
||||||||||
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<E>
org.geotools.util.WeakHashSet<E>
E
- The type of elements in the set.public class WeakHashSet<E>
A set of objects hold by weak references. An entry in a WeakHashSet
will automatically be removed when it is no longer in ordinary use. More precisely,
the presence of an entry will not prevent the entry from being discarded by the
garbage collector, that is, made finalizable, finalized, and then reclaimed.
When an entry has been discarded it is effectively removed from the set, so
this class behaves somewhat differently than other Set
implementations.
If you would like to use WeakHashSet
as inside a factory to prevent creating
duplicate immutable objects, please look at the CanonicalSet
subclass.
The WeakHashSet
class is thread-safe.
WeakHashMap
Constructor Summary | |
---|---|
WeakHashSet()
Deprecated. Use WeakHashSet(Class) . |
|
WeakHashSet(java.lang.Class<E> type)
Constructs a WeakHashSet . |
Method Summary | |
---|---|
boolean |
add(E obj)
Adds the specified element to this set if it is not already present. |
void |
clear()
Removes all of the elements from this set. |
boolean |
contains(java.lang.Object obj)
Returns true if this set contains the specified element. |
java.lang.Class<E> |
getElementType()
Returns the element type. |
java.util.Iterator<E> |
iterator()
Returns an iterator over the elements contained in this collection. |
boolean |
remove(java.lang.Object obj)
Removes a single instance of the specified element from this set, if it is present |
int |
size()
Returns the count of element in this set. |
E[] |
toArray()
Returns a view of this set as an array. |
Methods inherited from class java.util.AbstractSet |
---|
equals, hashCode, removeAll |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, containsAll, isEmpty, retainAll, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray |
Methods inherited from interface java.util.Set |
---|
addAll, containsAll, isEmpty, retainAll, toArray |
Constructor Detail |
---|
public WeakHashSet()
WeakHashSet(Class)
.
WeakHashSet
.
public WeakHashSet(java.lang.Class<E> type)
WeakHashSet
.
type
- The type of the element to be included in this set.Method Detail |
---|
public java.lang.Class<E> getElementType()
getElementType
in interface CheckedCollection<E>
public int size()
size
in interface java.util.Collection<E>
size
in interface java.util.Set<E>
size
in class java.util.AbstractCollection<E>
public boolean contains(java.lang.Object obj)
true
if this set contains the specified element.
contains
in interface java.util.Collection<E>
contains
in interface java.util.Set<E>
contains
in class java.util.AbstractCollection<E>
obj
- Object to be checked for containment in this set.
true
if this set contains the specified element.public boolean remove(java.lang.Object obj)
remove
in interface java.util.Collection<E>
remove
in interface java.util.Set<E>
remove
in class java.util.AbstractCollection<E>
obj
- element to be removed from this set, if present.
true
if the set contained the specified element.public boolean add(E obj)
false
.
add
in interface java.util.Collection<E>
add
in interface java.util.Set<E>
add
in class java.util.AbstractCollection<E>
obj
- Element to be added to this set.
true
if this set did not already contain the specified element.public void clear()
clear
in interface java.util.Collection<E>
clear
in interface java.util.Set<E>
clear
in class java.util.AbstractCollection<E>
public E[] toArray()
toArray
in interface java.util.Collection<E>
toArray
in interface java.util.Set<E>
toArray
in class java.util.AbstractCollection<E>
public java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
iterator
in interface java.util.Collection<E>
iterator
in interface java.util.Set<E>
iterator
in class java.util.AbstractCollection<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |