Jadex 0.941

jadex.util.collection
Class WeakSet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byjadex.util.collection.WeakSet
All Implemented Interfaces:
Collection, Serializable, Set

public class WeakSet
extends AbstractSet
implements Serializable

A weak set for entries that will be automatically removed when no references to them are existing any more.

See Also:
Serialized Form

Constructor Summary
WeakSet()
          Construct a WeakSet based on a HashSet.
 
Method Summary
 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.
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, retainAll
 

Constructor Detail

WeakSet

public WeakSet()
Construct a WeakSet based on a HashSet.

Method Detail

size

public int size()
Return the size of the set.

Specified by:
size in interface Set
Returns:
The size of the set.

iterator

public Iterator iterator()
Return an iteration over the elements in the set.

Specified by:
iterator in interface Set
Returns:
An iteration over the elements in the set.

toArray

public Object[] toArray()
Convert the set to an array.

Specified by:
toArray in interface Set

toArray

public Object[] toArray(Object[] result)
Convert the set to an array.

Specified by:
toArray in interface Set

add

public boolean add(Object obj)
Add an element to the set.

Specified by:
add in interface Set
Parameters:
obj - Element to add to the set.
Returns:
True if the element was added.

isEmpty

public boolean isEmpty()
Returns true if this set contains no elements.

Specified by:
isEmpty in interface Set
Returns:
true if this set contains no elements.

contains

public boolean contains(Object obj)
Returns true if this set contains the specified element.

Specified by:
contains in interface Set
Parameters:
obj - Element whose presence in this set is to be tested.
Returns:
true if this set contains the specified element.

remove

public boolean remove(Object obj)
Removes the given element from this set if it is present.

Specified by:
remove in interface Set
Parameters:
obj - Object to be removed from this set, if present.
Returns:
true if the set contained the specified element.

clear

public void clear()
Removes all of the elements from this set.

Specified by:
clear in interface Set

clone

public Object clone()
Returns a shallow copy of this WeakSet instance: the elements themselves are not cloned.

Returns:
A shallow copy of this set.

Jadex 0.941

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2005 Lars Braubach, Alexander Pokahr, Andrzej Walczak - University of Hamburg. Use is subject to license terms.