Class EmptyIterator

java.lang.Object
de.intarsys.tools.collection.EmptyIterator
All Implemented Interfaces:
Iterator

public class EmptyIterator extends Object implements Iterator
An Iterator over an empty collection.
  • Field Details

    • UNIQUE

      public static final Iterator UNIQUE
  • Constructor Details

    • EmptyIterator

      protected EmptyIterator()
      Create an EmptyIterator.
  • Method Details

    • hasNext

      public boolean hasNext()
      Return always false as an emtpy iterator has no elements.
      Specified by:
      hasNext in interface Iterator
      Returns:
      Return always false as an emtpy iterator has no elements.
    • next

      public Object next()
      Throw always exception, as an empty enumeration has no elements.
      Specified by:
      next in interface Iterator
      Returns:
      never
      Throws:
      NoSuchElementException - Is thrown always
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator