Package xyz.cofe.iter

Class LimitIterable.LimitIter<A>

java.lang.Object
xyz.cofe.iter.LimitIterable.LimitIter<A>
Type Parameters:
A - тип элементов
All Implemented Interfaces:
java.util.Iterator<A>
Enclosing class:
LimitIterable<A>

public static class LimitIterable.LimitIter<A>
extends java.lang.Object
implements java.util.Iterator<A>
Итератор с ограниченной по кол-ву выборкой
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected long count  
    protected java.util.Iterator<A> iter  
    protected long limit  
  • Constructor Summary

    Constructors 
    Constructor Description
    LimitIter​(java.util.Iterator<A> iter, long limit)
    Констркутор
  • Method Summary

    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, remove
  • Field Details

    • iter

      protected java.util.Iterator<A> iter
    • limit

      protected long limit
    • count

      protected volatile long count
  • Constructor Details

    • LimitIter

      public LimitIter​(java.util.Iterator<A> iter, long limit)
      Констркутор
      Parameters:
      iter - итератор
      limit - максимальное кол-во элементов
  • Method Details

    • hasNext

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

      public A next()
      Specified by:
      next in interface java.util.Iterator<A>