Class ConstantAppendingLongIterator

java.lang.Object
com.complexible.common.primitives.AbstractLongIterator
com.complexible.common.primitives.ConstantAppendingLongIterator
All Implemented Interfaces:
PeekingLongIterator, CloseableLongIterator, LongIterator, ResettableLongIterator, AutoCloseable

public class ConstantAppendingLongIterator extends AbstractLongIterator
This is a union of a long iterator with a constant. The constant is returned at the end only if the base iterator does not return it. This is useful, in particular, for implementing path iterations of length zero or more.
Version:
5.1
Author:
Pavel Klinov
  • Constructor Details

    • ConstantAppendingLongIterator

      public ConstantAppendingLongIterator(CloseableLongIterator theIterator, long theConstant)
  • Method Details

    • computeNext

      protected long computeNext()
      Computes the next long to be returned by the iterator. The only method supposed to be implemented by subclasses.
      Specified by:
      computeNext in class AbstractLongIterator
    • close

      public void close()
    • performReset

      protected void performReset()
      Description copied from class: AbstractLongIterator
      Resets the state so iteration can start over.
      Specified by:
      performReset in class AbstractLongIterator