Plexus v0.13.1

com.phoenixst.collections
Class SynchronizedCollection

java.lang.Object
  extended by com.phoenixst.collections.SynchronizedCollection
All Implemented Interfaces:
Serializable, Iterable, Collection

public class SynchronizedCollection
extends Object
implements Collection, Serializable

A synchronized view of another Collection.

Since:
1.0
Version:
$Revision: 1.5 $
Author:
Ray A. Conner
See Also:
Serialized Form

Constructor Summary
SynchronizedCollection(Collection delegate)
          Creates a synchronized view of the specified Collection.
SynchronizedCollection(Collection delegate, Object mutex)
          Creates a synchronized view of the specified Collection and synchronized upon the specified object.
 
Method Summary
 boolean add(Object object)
           
 boolean addAll(Collection collection)
           
 void clear()
           
 boolean contains(Object object)
           
 boolean containsAll(Collection collection)
           
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean remove(Object object)
           
 boolean removeAll(Collection collection)
           
 boolean retainAll(Collection collection)
           
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] array)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

SynchronizedCollection

public SynchronizedCollection(Collection delegate)
Creates a synchronized view of the specified Collection. It is the user's responsibility to manually synchronize on the created Collection when iterating over it. The created Collection will be serializable if the specified delegate is serializable.

Parameters:
delegate - the Collection for which a synchronized view is to be created.

SynchronizedCollection

public SynchronizedCollection(Collection delegate,
                              Object mutex)
Creates a synchronized view of the specified Collection and synchronized upon the specified object. It is the user's responsibility to manually synchronize on the created Collection when iterating over it. The created Collection will be serializable if the specified delegate is serializable.

Parameters:
delegate - the Collection for which a synchronized view is to be created.
Method Detail

size

public int size()
Specified by:
size in interface Collection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection

clear

public void clear()
Specified by:
clear in interface Collection

add

public boolean add(Object object)
Specified by:
add in interface Collection

remove

public boolean remove(Object object)
Specified by:
remove in interface Collection

contains

public boolean contains(Object object)
Specified by:
contains in interface Collection

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection

addAll

public boolean addAll(Collection collection)
Specified by:
addAll in interface Collection

containsAll

public boolean containsAll(Collection collection)
Specified by:
containsAll in interface Collection

removeAll

public boolean removeAll(Collection collection)
Specified by:
removeAll in interface Collection

retainAll

public boolean retainAll(Collection collection)
Specified by:
retainAll in interface Collection

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection

toArray

public Object[] toArray(Object[] array)
Specified by:
toArray in interface Collection

toString

public String toString()
Overrides:
toString in class Object

Plexus v0.13.1

See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.