Class EmptyIterator

  • All Implemented Interfaces:
    java.util.Iterator

    public class EmptyIterator
    extends java.lang.Object
    implements java.util.Iterator
    An Iterator over an empty collection.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Iterator UNIQUE  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected EmptyIterator()
      Create an EmptyIterator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Return always false as an emtpy iterator has no elements.
      java.lang.Object next()
      Throw always exception, as an empty enumeration has no elements.
      void remove()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Field Detail

      • UNIQUE

        public static final java.util.Iterator UNIQUE
    • Constructor Detail

      • EmptyIterator

        protected EmptyIterator()
        Create an EmptyIterator.
    • Method Detail

      • hasNext

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

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

        public void remove()
        Specified by:
        remove in interface java.util.Iterator