Class AugmentingIterator<O>

  • Type Parameters:
    O - The type of Iterator to augment
    All Implemented Interfaces:
    java.util.Iterator<O>

    public class AugmentingIterator<O>
    extends java.lang.Object
    implements java.util.Iterator<O>
    This iterator wraps another iterator and provides a set of other elements of the same type interspersed with those provided by the wrapped iterator. It takes a function that can provide an extra set of elements for each one provided by the wrapped iterator. If the function returns a non-null value, then that element is taken as a list of extra elements to be returned before the next wrapped element is seen.
    • Constructor Summary

      Constructors 
      Constructor Description
      AugmentingIterator​(java.util.Iterator<O> wrapped, java.util.function.Function<O,​java.util.List<O>> function)  
    • Method Summary

      Modifier and Type Method Description
      boolean hasNext()  
      O next()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Constructor Detail

      • AugmentingIterator

        public AugmentingIterator​(java.util.Iterator<O> wrapped,
                                  java.util.function.Function<O,​java.util.List<O>> function)
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<O>
      • next

        public O next()
        Specified by:
        next in interface java.util.Iterator<O>