Class PrimitiveLongCollections.PrimitiveLongBaseIterator

  • All Implemented Interfaces:
    java.util.Iterator<java.lang.Long>, java.util.PrimitiveIterator<java.lang.Long,​java.util.function.LongConsumer>, java.util.PrimitiveIterator.OfLong
    Direct Known Subclasses:
    PrimitiveLongCollections.PrimitiveLongRangeIterator
    Enclosing class:
    PrimitiveLongCollections

    public abstract static class PrimitiveLongCollections.PrimitiveLongBaseIterator
    extends java.lang.Object
    implements java.util.PrimitiveIterator.OfLong
    Base iterator for simpler implementations of PrimitiveIterator.OfLongs.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.PrimitiveIterator

        java.util.PrimitiveIterator.OfDouble, java.util.PrimitiveIterator.OfInt, java.util.PrimitiveIterator.OfLong
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long next  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract boolean fetchNext()
      Fetches the next item in this iterator.
      boolean hasNext()  
      protected boolean next​(long nextItem)
      Called from inside an implementation of fetchNext() if a next item was found.
      long nextLong()  
      • 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

        remove
      • Methods inherited from interface java.util.PrimitiveIterator.OfLong

        forEachRemaining, forEachRemaining, next
    • Field Detail

      • next

        protected long next
    • Constructor Detail

      • PrimitiveLongBaseIterator

        public PrimitiveLongBaseIterator()
    • Method Detail

      • hasNext

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

        public long nextLong()
        Specified by:
        nextLong in interface java.util.PrimitiveIterator.OfLong
      • fetchNext

        protected abstract boolean fetchNext()
        Fetches the next item in this iterator. Returns whether or not a next item was found. If a next item was found, that value must have been set inside the implementation of this method using next(long).
      • next

        protected boolean next​(long nextItem)
        Called from inside an implementation of fetchNext() if a next item was found. This method returns true so that it can be used in short-hand conditionals (TODO what are they called?), like:
         protected boolean fetchNext()
         {
             return source.hasNext() ? next( source.next() ) : false;
         }
         
        Parameters:
        nextItem - the next item found.