T - the type of objects that the iterator returnspublic class LimitedIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>
| Constructor and Description |
|---|
LimitedIterator(java.util.Iterator<? extends T> backingItr,
int limit)
Constructs the limited iterator from a backing iterator and a limit that
determines how many of the backing iterator's elements will be returned
by the limited iterator.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext() |
T |
next() |
void |
remove() |
public LimitedIterator(java.util.Iterator<? extends T> backingItr, int limit)
backingItr - the iterator that will be used to back this iterator. May not
be null.limit - the number of elements that will be returned by the limited
iterator. If the limit is zero or negative, there is no limit
on the number of items returned.java.lang.NullPointerException - if the backing iterator is null.Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.