| |
|
| java.lang.Object ch.ethz.prose.WeakSet
WeakSet | public class WeakSet implements Set(Code) | | Wrapper for a Set using weak references
to store values. The refered objects may be garbage
collected...
See Also: java.util.Set See Also: java.lang.ref.WeakReference version: $Revision$ author: Angela Nicoara author: Gerald Linhofer |
Constructor Summary | |
public | WeakSet() Default constructor uses a HashSet
as set implementation. | public | WeakSet(Set baseSet) Constructor, which allows to pass the set implementation
as parameter. |
Method Summary | |
public boolean | add(Object o) Adds the specified element to this set if it is not
already present (optional operation). | public boolean | addAll(Collection c) Adds all of the elements in the specified collection
to this set if they're not already present.
Parameters: c - Adds all of the elements in the specified collection to this set if they're not already present true if this set was changed during operation throws: ClassCastException - if the class of some element of the specified collection prevents it from being added to this set. | public void | clear() | public boolean | contains(Object o) | public boolean | containsAll(Collection c) Returns true if this set contains all of the elements
of the specified collection. | public boolean | isEmpty() | public Iterator | iterator() Returns an iterator over the elements in this set. | public boolean | remove(Object o) Removes the specified element from this set if it is
present (optional operation). | public boolean | removeAll(Collection c) Not implemented. | public boolean | retainAll(Collection c) Not implemented. | public int | size() | public Object[] | toArray() | public Object[] | toArray(Object[] a) |
WeakSet | public WeakSet()(Code) | | Default constructor uses a HashSet
as set implementation.
|
WeakSet | public WeakSet(Set baseSet)(Code) | | Constructor, which allows to pass the set implementation
as parameter. The passed set may not be null and has to be
empty.
Parameters: baseSet - an empty set that will be used internal asset implementation. |
add | public boolean add(Object o)(Code) | | Adds the specified element to this set if it is not
already present (optional operation). More formally,
adds the specified element, o, to this set if this
set contains no element e such that (o==null ? e==null
: o.equals(e)). If this set already contains the
specified element, the call leaves this set unchanged
and returns false. In combination with the restriction
on constructors, this ensures that sets never contain
duplicate elements.
See Also: java.util.Set.add |
addAll | public boolean addAll(Collection c)(Code) | | Adds all of the elements in the specified collection
to this set if they're not already present.
Parameters: c - Adds all of the elements in the specified collection to this set if they're not already present true if this set was changed during operation throws: ClassCastException - if the class of some element of the specified collection prevents it from being added to this set. throws: NullPointerException - if the specified collection contains one or more null elements and this set does not support null elements, or if the specified collection is null. throws: IllegalArgumentException - if some aspect of some element of the specified collection prevents it from being added to this set. See Also: java.util.Set.addAll(java.util.Collection) |
clear | public void clear()(Code) | | |
containsAll | public boolean containsAll(Collection c)(Code) | | Returns true if this set contains all of the elements
of the specified collection. If the specified collection
is also a set, this method returns true if it is a
subset of this set.
Parameters: c - collection to be checked for containment in this set. true if this set contains all of the elements of the specified collection. throws: ClassCastException - if the types of one or more elements in the specified collection are incompatible with this set (optional). throws: NullPointerException - if the specified collection contains one or more null elements and this set does not support null elements (optional). Or if the specified collection is null. See Also: java.util.Set.containsAll(java.util.Collection) |
isEmpty | public boolean isEmpty()(Code) | | |
iterator | public Iterator iterator()(Code) | | Returns an iterator over the elements in this set.
The elements are returned in no particular order
(unless this set uses an instance of some class that
provides a guarantee).
an iterator over the elements in this set. See Also: java.util.Set.iterator |
remove | public boolean remove(Object o)(Code) | | Removes the specified element from this set if it is
present (optional operation). More formally, removes
an element e such that (o==null ? e==null : o.equals(e)),
if the set contains such an element. Returns true if
the set contained the specified element (or equivalently,
if the set changed as a result of the call). (The set
will not contain the specified element once the call
returns.)
Parameters: o - - object to be removed from this set, if present. true if the set contained the specified element. throws: ClassCastException - if the type of the specified element is incompatible with this set (optional). throws: NullPointerException - if the specified element is null and this set does not support null elements (optional). throws: UnsupportedOperationException - if the remove method is not supported by the underlying set. See Also: java.util.Set.remove(java.lang.Object) |
|
|
|