org.apache.lucene.util.hppc

## Class IntIntHashMap.AbstractIterator<E>

- java.lang.Object
- - org.apache.lucene.util.hppc.IntIntHashMap.AbstractIterator<E>

- All Implemented Interfaces:
    Iterator<E>
  Enclosing class:
    IntIntHashMap

      public abstract static class IntIntHashMap.AbstractIterator<E>
      extends Object
      implements Iterator<E>

  Simplifies the implementation of iterators a bit. Modeled loosely after Google Guava's API.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractIterator()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected E` | `done()` Call when done.
    `protected abstract E` | `fetch()` Fetch next element.
    `boolean` | `hasNext()`
    `E` | `next()`
    `void` | `remove()` Default implementation throws `UnsupportedOperationException`.

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

- - ### Constructor Detail

    - #### AbstractIterator

          public AbstractIterator()

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<E>`

    - #### next

          public E next()

      Specified by:
        `next` in interface `Iterator<E>`

    - #### remove

          public void remove()

      Default implementation throws `UnsupportedOperationException`.
      Specified by:
        `remove` in interface `Iterator<E>`

    - #### fetch

          protected abstract E fetch()

      Fetch next element. The implementation must return `done()` when all elements have been fetched.
      Returns:
        Returns the next value for the iterator or chain-calls `done()`.

    - #### done

          protected final E done()

      Call when done.
      Returns:
        Returns a unique sentinel value to indicate end-of-iteration.

Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.