Package com.globalmentor.collections
Class SynchronizedSetDecorator<E>
- java.lang.Object
-
- com.globalmentor.collections.SynchronizedCollectionDecorator<E>
-
- com.globalmentor.collections.SynchronizedSetDecorator<E>
-
- Type Parameters:
E
- The type of element contained in the set.
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
public class SynchronizedSetDecorator<E> extends SynchronizedCollectionDecorator<E> implements java.util.Set<E>
A set that wraps an existing set, providing access through theSet
interface. All collection access is synchronized on the provided synchronization object.- Author:
- Garret Wilson
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<E>
set
The set this class decorates.-
Fields inherited from class com.globalmentor.collections.SynchronizedCollectionDecorator
collection, mutex
-
-
Constructor Summary
Constructors Constructor Description SynchronizedSetDecorator(java.util.Set<E> set)
Set constructor.SynchronizedSetDecorator(java.util.Set<E> set, java.lang.Object mutex)
Set and mutex constructor.
-
Method Summary
-
Methods inherited from class com.globalmentor.collections.SynchronizedCollectionDecorator
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
-
-
-
-
Field Detail
-
set
protected final java.util.Set<E> set
The set this class decorates.
-
-
Constructor Detail
-
SynchronizedSetDecorator
public SynchronizedSetDecorator(java.util.Set<E> set)
Set constructor. The new instance of this class is used as a mutex.- Parameters:
set
- The set this set should decorate.- Throws:
java.lang.NullPointerException
- if the provided set isnull
.
-
SynchronizedSetDecorator
public SynchronizedSetDecorator(java.util.Set<E> set, java.lang.Object mutex)
Set and mutex constructor.- Parameters:
set
- The set this set should decorate.mutex
- The mutual exclusion synchronization object.- Throws:
java.lang.NullPointerException
- if the provided set and/or mutex isnull
.
-
-