Class RemovableIterator<C>

java.lang.Object
org.infinispan.commons.util.RemovableIterator<C>
All Implemented Interfaces:
Iterator<C>
Direct Known Subclasses:
RemovableCloseableIterator, RemovableIterator

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 Details

    • realIterator

      protected final Iterator<C> realIterator
    • consumer

      protected final Consumer<? super C> consumer
    • previousValue

      protected C previousValue
    • currentValue

      protected C currentValue
  • Constructor Details

    • RemovableIterator

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

    • getNextFromIterator

      protected C getNextFromIterator()
    • hasNext

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

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

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