org.eclipse.net4j.util.collection

## Class AbstractIterator<T>

- java.lang.Object
- - org.eclipse.net4j.util.collection.AbstractIterator<T>

- All Implemented Interfaces:
    java.util.Iterator<T>
  Direct Known Subclasses:
    AbstractCloseableIterator, AbstractFilteredIterator, AbstractListIterator, ComposedIterator

      public abstract class AbstractIterator<T>
      extends java.lang.Object
      implements java.util.Iterator<T>

  An abstract base class for custom iterators that only requires to implement a single `computeNextElement()` method.
  Since:
    3.2
  Author:
    Eike Stepper

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static java.lang.Object` | `END_OF_DATA` The token to be used in `computeNextElement()` to indicate the end of the iteration.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractIterator()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract java.lang.Object` | `computeNextElement()` Returns the next iteration element, or `END_OF_DATA` if the end of the iteration has been reached.
    `static <T> java.util.ListIterator<T>` | `empty()`
    `boolean` | `hasNext()`
    `T` | `next()`
    `void` | `remove()`

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

- - ### Field Detail

    - #### END_OF_DATA

          protected static final java.lang.Object END_OF_DATA

      The token to be used in `computeNextElement()` to indicate the end of the iteration.

  - ### Constructor Detail

    - #### AbstractIterator

          public AbstractIterator()

  - ### Method Detail

    - #### hasNext

          public final boolean hasNext()

      Specified by:
        `hasNext` in interface `java.util.Iterator<T>`

    - #### next

          public final T next()

      Specified by:
        `next` in interface `java.util.Iterator<T>`

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `java.util.Iterator<T>`

    - #### computeNextElement

          protected abstract java.lang.Object computeNextElement()

      Returns the next iteration element, or `END_OF_DATA` if the end of the iteration has been reached.

    - #### empty

          public static <T> java.util.ListIterator<T> empty()

      Since:
        3.4

Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html