Class SingletonIterator

  • All Implemented Interfaces:
    java.util.Iterator<java.lang.String>

    public final class SingletonIterator
    extends java.lang.Object
    implements java.util.Iterator<java.lang.String>
    Simple read-only iterator that iterators over one specific item, passed in as constructor argument.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean _done  
      private java.lang.String _value  
    • Constructor Summary

      Constructors 
      Constructor Description
      SingletonIterator​(java.lang.String value)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      java.lang.String next()  
      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

      • _value

        private final java.lang.String _value
      • _done

        private boolean _done
    • Constructor Detail

      • SingletonIterator

        public SingletonIterator​(java.lang.String value)
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<java.lang.String>
      • next

        public java.lang.String next()
        Specified by:
        next in interface java.util.Iterator<java.lang.String>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<java.lang.String>