public class

SynchronizedSet

extends SynchronizedCollection
implements Set<E>
java.lang.Object
   ↳ org.apache.commons.collections.collection.SynchronizedCollection
     ↳ org.apache.commons.collections.set.SynchronizedSet

Class Overview

Decorates another Set to synchronize its behaviour for a multi-threaded environment.

Methods are synchronized, then forwarded to the decorated set.

This class is Serializable from Commons Collections 3.1.

Summary

[Expand]
Inherited Fields
From class org.apache.commons.collections.collection.SynchronizedCollection
Protected Constructors
SynchronizedSet(Set set)
Constructor that wraps (not copies).
SynchronizedSet(Set set, Object lock)
Constructor that wraps (not copies).
Public Methods
static Set decorate(Set set)
Factory method to create a synchronized set.
Protected Methods
Set getSet()
Gets the decorated set.
[Expand]
Inherited Methods
From class org.apache.commons.collections.collection.SynchronizedCollection
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.Set

Protected Constructors

protected SynchronizedSet (Set set)

Constructor that wraps (not copies).

Parameters
set the set to decorate, must not be null
Throws
IllegalArgumentException if set is null

protected SynchronizedSet (Set set, Object lock)

Constructor that wraps (not copies).

Parameters
set the set to decorate, must not be null
lock the lock object to use, must not be null
Throws
IllegalArgumentException if set is null

Public Methods

public static Set decorate (Set set)

Factory method to create a synchronized set.

Parameters
set the set to decorate, must not be null
Throws
IllegalArgumentException if set is null

Protected Methods

protected Set getSet ()

Gets the decorated set.

Returns
  • the decorated set