Class OneElementIterator<T>

java.lang.Object
com.saperion.common.lang.iterator.OneElementIterator<T>
Type Parameters:
T - type of objects to iterate
All Implemented Interfaces:
Iterator<T>

public final class OneElementIterator<T> extends Object implements Iterator<T>

An Iterator that iterates through exactly one element.

Iterator.remove() is not supported.

Author:
agz
  • Constructor Details

    • OneElementIterator

      public OneElementIterator(T object)
      Creates a new OneElementIterator, that iterates through exactly one (the specified) element.

      The specified object may be null. The new OneElementIterator will still have one element and its first call to next() will return null.

      Parameters:
      object - object to iterate through
  • Method Details