Package com.complexible.common.primitives

# Class AbstractLongIterator

java.lang.Object
com.complexible.common.primitives.AbstractLongIterator

All Implemented Interfaces:
  `PeekingLongIterator`, `CloseableLongIterator`, `LongIterator`, `ResettableLongIterator`, `AutoCloseable`

Direct Known Subclasses:
  `AbstractSkippingLongIterator`, `ConstantAppendingLongIterator`

public abstract class AbstractLongIterator extends Object implements ResettableLongIterator, PeekingLongIterator, CloseableLongIterator
A skeleton implementation of `LongIterator` allowing subclasses to concentrate of computing next elements.

Version:
  5.1
Author:
  Pavel Klinov

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected long`
  `mNext`

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

  `NO_NEXT_ELEMENT`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractLongIterator()`
  `protected`
  `AbstractLongIterator(long theFirst)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract long`
  `computeNext()`
  Computes the next long to be returned by the iterator.
  `protected final long`
  `endOfData()`
  `boolean`
  `hasNext()`
  `final long`
  `next()`
  `final long`
  `peek()`
  `protected abstract void`
  `performReset()`
  Resets the state so iteration can start over.
  `final void`
  `reset()`

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

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

  ### Methods inherited from interface com.complexible.common.primitives.CloseableLongIterator

  `close`

- ## Field Details

  - ### mNext

    protected long mNext

- ## Constructor Details

  - ### AbstractLongIterator

    protected AbstractLongIterator()

  - ### AbstractLongIterator

    protected AbstractLongIterator(long theFirst)

- ## Method Details

  - ### reset

    public final void reset()
    Specified by:
      `reset` in interface `ResettableLongIterator`

  - ### hasNext

    public boolean hasNext()
    Specified by:
      `hasNext` in interface `LongIterator`

  - ### next

    public final long next()
    Specified by:
      `next` in interface `LongIterator`

  - ### peek

    public final long peek()
    Specified by:
      `peek` in interface `PeekingLongIterator`

  - ### endOfData

    protected final long endOfData()

  - ### computeNext

    protected abstract long computeNext()
    Computes the next long to be returned by the iterator. The only method supposed to be implemented by subclasses.

  - ### performReset

    protected abstract void performReset()
    Resets the state so iteration can start over.