Class 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 the Set interface. All collection access is synchronized on the provided synchronization object.
    Author:
    Garret Wilson
    • 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 is null.
      • 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 is null.