Class DirtySet<E>

  • Type Parameters:
    E - type of the set
    All Implemented Interfaces:
    Iterable<E>, Collection<E>, Set<E>

    public class DirtySet<E>
    extends SetDecorator<E>
    A Set decorator that notifies the provided DirtyListener when one ore more elements are removed.
    • Constructor Detail

      • DirtySet

        public DirtySet​(Set<E> set,
                        DirtyListener listener)
        Constructs a new set decorator, wrapping the specified set.
        Parameters:
        set - the set to wrap with the decorator.
        listener - the change observer
    • Method Detail

      • remove

        public boolean remove​(Object o)
        Description copied from class: SetDecorator
        Removes the specified element from the set if it is present (optional operation).
        Specified by:
        remove in interface Collection<E>
        Specified by:
        remove in interface Set<E>
        Overrides:
        remove in class SetDecorator<E>
        Parameters:
        o - object to be removed from the set, if present.
        Returns:
        true if the set contained the specified element.
      • removeAll

        public boolean removeAll​(Collection<?> c)
        Description copied from class: SetDecorator
        Removes from the set all of its elements that are contained in the specified collection (optional operation).
        Specified by:
        removeAll in interface Collection<E>
        Specified by:
        removeAll in interface Set<E>
        Overrides:
        removeAll in class SetDecorator<E>
        Parameters:
        c - collection containing elements to be removed from the set.
        Returns:
        true if the set changed as a result of the call.
      • retainAll

        public boolean retainAll​(Collection<?> c)
        Description copied from class: SetDecorator
        Retains only the elements in the set that are contained in the specified collection (optional operation).
        Specified by:
        retainAll in interface Collection<E>
        Specified by:
        retainAll in interface Set<E>
        Overrides:
        retainAll in class SetDecorator<E>
        Parameters:
        c - collection containing elements to be retained in the set.
        Returns:
        true if the set changed as a result of the call.