Class SynchronizedCollection
java.lang.Object
org.apache.commons.collections.collection.SynchronizedCollection
- All Implemented Interfaces:
Serializable,Iterable,Collection
- Direct Known Subclasses:
SynchronizedBag,SynchronizedBuffer,SynchronizedList,SynchronizedSet,SynchronizedSortedSet
@Deprecated(since="2021-04-30")
public class SynchronizedCollection
extends Object
implements Collection, Serializable
Deprecated.
Apache Commons Collections version 3.x is being deprecated from AEMaaCS. The upgraded version 4.4 of Commons Collections is already included as replacement. Customers are advised to upgrade to this version of the library. Please note: the package name was changed to org.apache.commons.collections4. Further note that there are AEM APIs currently exposing the old collections classes; these will be updated in upcoming releases.
Decorates another
Collection to synchronize its behaviour
for a multi-threaded environment.
Iterators must be manually synchronized:
synchronized (coll) {
Iterator it = coll.iterator();
// do stuff with iterator
}
This class is Serializable from Commons Collections 3.1.
- Since:
- Commons Collections 3.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.booleanaddAll(Collection coll) Deprecated.voidclear()Deprecated.booleanDeprecated.booleancontainsAll(Collection coll) Deprecated.static Collectiondecorate(Collection coll) Deprecated.Factory method to create a synchronized collection.booleanDeprecated.inthashCode()Deprecated.booleanisEmpty()Deprecated.iterator()Deprecated.Iterators must be manually synchronized.booleanDeprecated.booleanremoveAll(Collection coll) Deprecated.booleanretainAll(Collection coll) Deprecated.intsize()Deprecated.Object[]toArray()Deprecated.Object[]Deprecated.toString()Deprecated.Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Method Details
-
decorate
Deprecated.Factory method to create a synchronized collection.- Parameters:
coll- the collection to decorate, must not be null- Returns:
- a new synchronized collection
- Throws:
IllegalArgumentException- if collection is null
-
add
Deprecated.- Specified by:
addin interfaceCollection
-
addAll
Deprecated.- Specified by:
addAllin interfaceCollection
-
clear
public void clear()Deprecated.- Specified by:
clearin interfaceCollection
-
contains
Deprecated.- Specified by:
containsin interfaceCollection
-
containsAll
Deprecated.- Specified by:
containsAllin interfaceCollection
-
isEmpty
public boolean isEmpty()Deprecated.- Specified by:
isEmptyin interfaceCollection
-
iterator
Deprecated.Iterators must be manually synchronized.synchronized (coll) { Iterator it = coll.iterator(); // do stuff with iterator }- Specified by:
iteratorin interfaceCollection- Specified by:
iteratorin interfaceIterable- Returns:
- an iterator that must be manually synchronized on the collection
-
toArray
Deprecated.- Specified by:
toArrayin interfaceCollection
-
toArray
Deprecated.- Specified by:
toArrayin interfaceCollection
-
remove
Deprecated.- Specified by:
removein interfaceCollection
-
removeAll
Deprecated.- Specified by:
removeAllin interfaceCollection
-
retainAll
Deprecated.- Specified by:
retainAllin interfaceCollection
-
size
public int size()Deprecated.- Specified by:
sizein interfaceCollection
-
equals
Deprecated.- Specified by:
equalsin interfaceCollection- Overrides:
equalsin classObject
-
hashCode
public int hashCode()Deprecated.- Specified by:
hashCodein interfaceCollection- Overrides:
hashCodein classObject
-
toString
Deprecated.
-