public class WeakSet extends AbstractSet implements Serializable
Constructor and Description |
---|
WeakSet()
Construct a WeakSet based on a HashSet.
|
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.
|
boolean |
remove(Object obj)
Removes the given element from this set if it is present.
|
int |
size()
Return the size of the set.
|
Object[] |
toArray()
Convert the set to an array.
|
Object[] |
toArray(Object[] result)
Convert the set to an array.
|
equals, hashCode, removeAll
addAll, containsAll, retainAll, toString
addAll, containsAll, retainAll
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 Object[] toArray()
toArray
in interface Collection
toArray
in interface Set
toArray
in class AbstractCollection
public Object[] toArray(Object[] result)
toArray
in interface Collection
toArray
in interface Set
toArray
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
Copyright © 2012. All Rights Reserved.