Class ForEachSupport.ToEndIterator

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

    private static class ForEachSupport.ToEndIterator
    extends ForEachSupport.ReadOnlyIterator
    Iterator that simply counts up to 'end.' Unlike the previous implementation this does not attempt to pre-allocate an array containing all values from 0 to 'end' as that can result in excessive memory allocation for large values of 'end.' LoopTagSupport calls next() 'begin' times in order to discard the initial values, In order to maintain this contract, this implementation always starts at 0. Future optimization to skip these redundant calls might be possible.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int end  
      private int i  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ToEndIterator​(int end)  
    • Method Summary

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

      • end

        private final int end
      • i

        private int i
    • Constructor Detail

      • ToEndIterator

        private ToEndIterator​(int end)
    • Method Detail

      • hasNext

        public boolean hasNext()
      • next

        public java.lang.Object next()