Package com.complexible.common.primitives

# 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

- ## Field Summary

  ### Fields inherited from class com.complexible.common.primitives.AbstractLongIterator

  `mNext`

  ### Fields inherited from interface com.complexible.common.primitives.LongIterator

  `NO_NEXT_ELEMENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ConstantAppendingLongIterator(CloseableLongIterator theIterator, long theConstant)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `protected long`
  `computeNext()`
  Computes the next long to be returned by the iterator.
  `protected void`
  `performReset()`
  Resets the state so iteration can start over.

  ### Methods inherited from class com.complexible.common.primitives.AbstractLongIterator

  `endOfData, hasNext, next, peek, reset`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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`