Package com.norconex.commons.lang.collection

# Class CountingIterator<T>

java.lang.Object
org.apache.commons.collections4.iterators.AbstractUntypedIteratorDecorator<E,E>
org.apache.commons.collections4.iterators.AbstractIteratorDecorator<T>
com.norconex.commons.lang.collection.CountingIterator<T>

Type Parameters:
  `T` - iterator type

All Implemented Interfaces:
  `Iterator<T>`

public class CountingIterator<T> extends AbstractIteratorDecorator<T>
Counts the number of time `next()` was invoked.

Since:
  2.0.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CountingIterator(Iterator<T> iterator)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getCount()`
  `T`
  `next()`

  ### Methods inherited from class org.apache.commons.collections4.iterators.AbstractUntypedIteratorDecorator

  `getIterator, hasNext, 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`

- ## Constructor Details

  - ### CountingIterator

    public CountingIterator(Iterator<T> iterator)

- ## Method Details

  - ### next

    public T next()
    Specified by:
      `next` in interface `Iterator<T>`
    Overrides:
      `next` in class `AbstractIteratorDecorator<T>`

  - ### getCount

    public int getCount()