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:
Iterable<E>, Collection<E>, Set<E>

public class SynchronizedSetDecorator<E> extends SynchronizedCollectionDecorator<E> implements Set<E>
A set that wraps an existing set, providing access through the Set interface. All collection access is synchronized on the provided synchronization object.
Author:
Garret Wilson
  • Field Details

    • set

      protected final Set<E> set
      The set this class decorates.
  • Constructor Details

    • SynchronizedSetDecorator

      public SynchronizedSetDecorator(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:
      NullPointerException - if the provided set is null.
    • SynchronizedSetDecorator

      public SynchronizedSetDecorator(Set<E> set, Object mutex)
      Set and mutex constructor.
      Parameters:
      set - The set this set should decorate.
      mutex - The mutual exclusion synchronization object.
      Throws:
      NullPointerException - if the provided set and/or mutex is null.