Class Namespace.EmptyIterator

  • All Implemented Interfaces:
    java.util.Iterator
    Enclosing class:
    Namespace

    protected class Namespace.EmptyIterator
    extends java.lang.Object
    implements java.util.Iterator
    An empty iterator that allows me to traverse in case of null objects.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected EmptyIterator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Always returns false, as an empty iterator.
      java.lang.Object next()
      Returns a null as we are iterating over nothing.
      void remove()
      Returns a false, as no removal
      • 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
    • Constructor Detail

      • EmptyIterator

        protected EmptyIterator()
    • Method Detail

      • hasNext

        public boolean hasNext()
        Always returns false, as an empty iterator.
        Specified by:
        hasNext in interface java.util.Iterator
        Returns:
        false
      • next

        public java.lang.Object next()
        Returns a null as we are iterating over nothing.
        Specified by:
        next in interface java.util.Iterator
        Returns:
        null
      • remove

        public void remove()
        Returns a false, as no removal
        Specified by:
        remove in interface java.util.Iterator