Class TakingIterator<A>

  • All Implemented Interfaces:
    java.util.Iterator<A>

    public final class TakingIterator<A>
    extends ImmutableIterator<A>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int currentIndex  
      private java.util.Iterator<A> iterator  
      private int n  
    • Constructor Summary

      Constructors 
      Constructor Description
      TakingIterator​(int n, java.util.Iterator<A> iterator)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      A 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

      • n

        private final int n
      • iterator

        private final java.util.Iterator<A> iterator
      • currentIndex

        private int currentIndex
    • Constructor Detail

      • TakingIterator

        public TakingIterator​(int n,
                              java.util.Iterator<A> iterator)
    • Method Detail

      • hasNext

        public boolean hasNext()
      • next

        public A next()