org.apache.pivot.collections.concurrent
Class SynchronizedSet<E>

java.lang.Object
  extended by org.apache.pivot.collections.concurrent.SynchronizedCollection<E>
      extended by org.apache.pivot.collections.concurrent.SynchronizedSet<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, Group<E>, Set<E>

public class SynchronizedSet<E>
extends SynchronizedCollection<E>
implements Set<E>

Synchronized implementation of the Set interface.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Set
Set.SetListenerList<E>
 
Field Summary
 
Fields inherited from class org.apache.pivot.collections.concurrent.SynchronizedCollection
collection
 
Constructor Summary
SynchronizedSet(Set<E> set)
           
 
Method Summary
 boolean add(E element)
          Adds an element to the group.
 boolean contains(E element)
          Tests the existence of an element in the group.
 int getCount()
          Returns the number of elements in the set.
 ListenerList<SetListener<E>> getSetListeners()
          Returns the set listener collection.
 boolean isEmpty()
          Tests the emptiness of the group.
 boolean remove(E element)
          Removes an element from the group.
 
Methods inherited from class org.apache.pivot.collections.concurrent.SynchronizedCollection
clear, getComparator, iterator, setComparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.pivot.collections.Set
clear, setComparator
 
Methods inherited from interface org.apache.pivot.collections.Collection
getComparator
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

SynchronizedSet

public SynchronizedSet(Set<E> set)
Method Detail

add

public boolean add(E element)
Description copied from interface: Group
Adds an element to the group.

Specified by:
add in interface Group<E>
Specified by:
add in interface Set<E>
Parameters:
element - The element to add to the group.
Returns:
true if the element was added to the group; false, otherwise.
See Also:
SetListener.elementAdded(Set, Object)

remove

public boolean remove(E element)
Description copied from interface: Group
Removes an element from the group.

Specified by:
remove in interface Group<E>
Specified by:
remove in interface Set<E>
Parameters:
element - The element to remove from the set.
Returns:
true if the element was removed from the group; false, otherwise.
See Also:
SetListener.elementRemoved(Set, Object)

contains

public boolean contains(E element)
Description copied from interface: Group
Tests the existence of an element in the group.

Specified by:
contains in interface Group<E>
Parameters:
element - The element whose presence in the group is to be tested.
Returns:
true if the element exists in the group; false, otherwise.

isEmpty

public boolean isEmpty()
Description copied from interface: Group
Tests the emptiness of the group.

Specified by:
isEmpty in interface Group<E>
Returns:
true if the group contains no elements; false, otherwise.

getCount

public int getCount()
Description copied from interface: Set
Returns the number of elements in the set.

Specified by:
getCount in interface Set<E>

getSetListeners

public ListenerList<SetListener<E>> getSetListeners()
Description copied from interface: Set
Returns the set listener collection.

Specified by:
getSetListeners in interface Set<E>