Class DirtyIterator<E>

  • Type Parameters:
    E - type of the iterator
    All Implemented Interfaces:
    Iterator<E>

    public class DirtyIterator<E>
    extends Object
    implements Iterator<E>
    An Iterator decorator that notifies the provided DirtyListener when one element is removed.
    • Constructor Detail

      • DirtyIterator

        public DirtyIterator​(Iterator<E> delegate,
                             DirtyListener listener)
        Builds a new DirtyIterator delegating to the given Iterator and notifying the provided observer.
        Parameters:
        delegate - Iterator delegate
        listener - change observer
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<E>
      • next

        public E next()
        Specified by:
        next in interface Iterator<E>
      • remove

        public void remove()
        Specified by:
        remove in interface Iterator<E>