Interface Iterator<T>

  • All Superinterfaces:
    java.util.Iterator<T>

    public interface Iterator<T>
    extends java.util.Iterator<T>
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static <T> Iterator<T> empty()
      Returns the singleton instance of the empty Iterator.
      static <T> Iterator<T> of​(T element)
      Creates an Iterator which iterates over the given element.
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, hasNext, next, remove
    • Method Detail

      • empty

        static <T> Iterator<T> empty()
        Returns the singleton instance of the empty Iterator.

        A call to Iterator.hasNext() will always return false. A call to Iterator.next() will always throw a NoSuchElementException.

        Type Parameters:
        T - Component type
        Returns:
        The empty Iterator
      • of

        static <T> Iterator<T> of​(T element)
        Creates an Iterator which iterates over the given element.
        Type Parameters:
        T - Type of the given element.
        Parameters:
        element - An element
        Returns:
        A new Iterator