Class SingletonIterator<E>

Type Parameters:
E - type of the element
All Implemented Interfaces:

public class SingletonIterator<E> extends Object implements Iterator<E>
Simple implementation of Iterator for iterating over a sequence consisting of a single element.
  • Constructor Details

    • SingletonIterator

      public SingletonIterator(E thing)
  • Method Details

    • 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()
      Specified by:
      remove in interface Iterator<E>