Build 1.0_r1(from source)

java.util
Class Collections.SynchronizedCollection<E>

java.lang.Object
  extended by java.util.Collections.SynchronizedCollection<E>
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>
Direct Known Subclasses:
Collections.SynchronizedList, Collections.SynchronizedSet
Enclosing class:
Collections

static class Collections.SynchronizedCollection<E>
extends Object
implements Collection<E>, Serializable


Field Summary
(package private)  Collection<E> c
           
(package private)  Object mutex
           
 
Constructor Summary
Collections.SynchronizedCollection(Collection<E> collection)
           
Collections.SynchronizedCollection(Collection<E> collection, Object mutex)
           
 
Method Summary
 boolean add(E object)
          Attempts to add object to the contents of this Collection.
 boolean addAll(Collection<? extends E> collection)
          Attempts to add all of the objects contained in collection to the contents of this collection.
 void clear()
          Removes all elements from this Collection, leaving it empty.
 boolean contains(Object object)
          Searches this Collection for the specified object.
 boolean containsAll(Collection<?> collection)
          Searches this Collection for all objects in the specified Collection.
 boolean isEmpty()
          Returns if this Collection has no elements, a size of zero.
 Iterator<E> iterator()
          Returns an instance of Iterator that may be used to access the objects contained by this collection.
 boolean remove(Object object)
          Removes the first occurrence of the specified object from this Collection.
 boolean removeAll(Collection<?> collection)
          Removes all occurrences in this Collection of each object in the specified Collection.
 boolean retainAll(Collection<?> collection)
          Removes all objects from this Collection that are not also found in the contents of collection.
 int size()
          Returns a count of how many objects are contained by this collection.
 Object[] toArray()
          Returns a new array containing all elements contained in this Collection.
<T> T[]
toArray(T[] array)
          Returns an array containing all elements contained in this Collection.
 String toString()
          Returns a string containing a concise, human-readable description of the receiver.
 
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
 

Field Detail

c

final Collection<E> c

mutex

final Object mutex
Constructor Detail

Collections.SynchronizedCollection

Collections.SynchronizedCollection(Collection<E> collection)

Collections.SynchronizedCollection

Collections.SynchronizedCollection(Collection<E> collection,
                                   Object mutex)
Method Detail

add

public boolean add(E object)
Description copied from interface: Collection
Attempts to add object to the contents of this Collection.

Specified by:
add in interface Collection<E>
Parameters:
object - the object to add
Returns:
true if this Collection is modified, false otherwise

addAll

public boolean addAll(Collection<? extends E> collection)
Description copied from interface: Collection
Attempts to add all of the objects contained in collection to the contents of this collection.

Specified by:
addAll in interface Collection<E>
Parameters:
collection - the Collection of objects
Returns:
true if this Collection is modified, false otherwise

clear

public void clear()
Description copied from interface: Collection
Removes all elements from this Collection, leaving it empty.

Specified by:
clear in interface Collection<E>
See Also:
Collection.isEmpty(), Collection.size()

contains

public boolean contains(Object object)
Description copied from interface: Collection
Searches this Collection for the specified object.

Specified by:
contains in interface Collection<E>
Parameters:
object - the object to search for
Returns:
true if object is an element of this Collection, false otherwise

containsAll

public boolean containsAll(Collection<?> collection)
Description copied from interface: Collection
Searches this Collection for all objects in the specified Collection.

Specified by:
containsAll in interface Collection<E>
Parameters:
collection - the Collection of objects
Returns:
true if all objects in the specified Collection are elements of this Collection, false otherwise

isEmpty

public boolean isEmpty()
Description copied from interface: Collection
Returns if this Collection has no elements, a size of zero.

Specified by:
isEmpty in interface Collection<E>
Returns:
true if this Collection has no elements, false otherwise
See Also:
Collection.size()

iterator

public Iterator<E> iterator()
Description copied from interface: Collection
Returns an instance of Iterator that may be used to access the objects contained by this collection.

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Returns:
an iterator for accessing the collection contents

remove

public boolean remove(Object object)
Description copied from interface: Collection
Removes the first occurrence of the specified object from this Collection.

Specified by:
remove in interface Collection<E>
Parameters:
object - the object to remove
Returns:
true if this Collection is modified, false otherwise

removeAll

public boolean removeAll(Collection<?> collection)
Description copied from interface: Collection
Removes all occurrences in this Collection of each object in the specified Collection.

Specified by:
removeAll in interface Collection<E>
Parameters:
collection - the Collection of objects to remove
Returns:
true if this Collection is modified, false otherwise

retainAll

public boolean retainAll(Collection<?> collection)
Description copied from interface: Collection
Removes all objects from this Collection that are not also found in the contents of collection.

Specified by:
retainAll in interface Collection<E>
Parameters:
collection - the Collection of objects to retain
Returns:
true if this Collection is modified, false otherwise

size

public int size()
Description copied from interface: Collection
Returns a count of how many objects are contained by this collection.

Specified by:
size in interface Collection<E>
Returns:
how many objects are contained by this collection

toArray

public Object[] toArray()
Description copied from interface: Collection
Returns a new array containing all elements contained in this Collection.

Specified by:
toArray in interface Collection<E>
Returns:
an array of the elements from this Collection

toString

public String toString()
Description copied from class: Object
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
String a printable representation for the receiver.

toArray

public <T> T[] toArray(T[] array)
Description copied from interface: Collection
Returns an array containing all elements contained in this Collection. If the specified array is large enough to hold the elements, the specified array is used, otherwise an array of the same type is created. If the specified array is used and is larger than this Collection, the array element following the collection elements is set to null.

Specified by:
toArray in interface Collection<E>
Parameters:
array - the array
Returns:
an array of the elements from this Collection

Build 1.0_r1(from source)

Please submit a feedback, bug or feature