Class SingleObjectIterator<T>

java.lang.Object
com.espertech.esper.common.internal.collection.SingleObjectIterator<T>
All Implemented Interfaces:
Iterator<T>

public class SingleObjectIterator<T> extends Object implements Iterator<T>
A utility class for an iterator that has zero or one element and can be reset with a new value.
  • Constructor Details

    • SingleObjectIterator

      public SingleObjectIterator(T object)
      Constructor, takes the single object to iterate over as a parameter. The single object can be null indicating that there are no more elements.
      Parameters:
      object - single object that the iterator returns, or null for an empty iterator
    • SingleObjectIterator

      public SingleObjectIterator()
      Ctor for an iterator starting out empty.
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public T next()
      Specified by:
      next in interface Iterator<T>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<T>