Class TakeIterator<T>

All Implemented Interfaces:

public final class TakeIterator<T> extends Object implements Iterator<T>
Iterates over the first count elements of the iterator or the full size of the iterator if the count is greater than the length of the receiver.
  • Constructor Details

    • TakeIterator

      public TakeIterator(Iterable<T> iterable, int count)
    • TakeIterator

      public TakeIterator(Iterator<T> iterator, int count)
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public T next()
      Specified by:
      next in interface Iterator<T>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<T>