Class RemovableIterator<C>

  • All Implemented Interfaces:
    Iterator<C>
    Direct Known Subclasses:
    RemovableCloseableIterator

    public class RemovableIterator<C>
    extends Object
    implements Iterator<C>
    An Iterator implementation that allows for a Iterator that doesn't allow remove operations to implement remove by delegating the call to the provided consumer to remove the previously read value.
    Since:
    9.1
    Author:
    wburns
    • Field Detail

      • realIterator

        protected final Iterator<C> realIterator
      • consumer

        protected final Consumer<? super C> consumer
      • previousValue

        protected C previousValue
      • currentValue

        protected C currentValue
    • Constructor Detail

      • RemovableIterator

        public RemovableIterator​(Iterator<C> realIterator,
                                 Consumer<? super C> consumer)
    • Method Detail

      • getNextFromIterator

        protected C getNextFromIterator()
      • hasNext

        public boolean hasNext()
      • next

        public C next()
      • remove

        public void remove()