Package org.apache.flink.util
Class NumberSequenceIterator
- java.lang.Object
-
- org.apache.flink.util.SplittableIterator<Long>
-
- org.apache.flink.util.NumberSequenceIterator
-
- All Implemented Interfaces:
Serializable,Iterator<Long>
@Public public class NumberSequenceIterator extends SplittableIterator<Long>
TheNumberSequenceIteratoris an iterator that returns a sequence of numbers (asLong)s. The iterator is splittable (as defined bySplittableIterator, i.e., it can be divided into multiple iterators that each return a subsequence of the number sequence.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NumberSequenceIterator(long from, long to)Creates a new splittable iterator, returning the range [from, to].
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetCurrent()intgetMaximumNumberOfSplits()The maximum number of splits into which this iterator can be split up.longgetTo()booleanhasNext()Longnext()voidremove()NumberSequenceIterator[]split(int numPartitions)Splits this iterator into a number disjoint iterators.-
Methods inherited from class org.apache.flink.util.SplittableIterator
getSplit
-
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
-
-
-
-
Constructor Detail
-
NumberSequenceIterator
public NumberSequenceIterator(long from, long to)Creates a new splittable iterator, returning the range [from, to]. Both boundaries of the interval are inclusive.- Parameters:
from- The first number returned by the iterator.to- The last number returned by the iterator.
-
-
Method Detail
-
getCurrent
public long getCurrent()
-
getTo
public long getTo()
-
hasNext
public boolean hasNext()
-
next
public Long next()
-
remove
public void remove()
-
split
public NumberSequenceIterator[] split(int numPartitions)
Description copied from class:SplittableIteratorSplits this iterator into a number disjoint iterators. The union of these iterators returns the original iterator values.- Specified by:
splitin classSplittableIterator<Long>- Parameters:
numPartitions- The number of iterators to split into.- Returns:
- An array with the split iterators.
-
getMaximumNumberOfSplits
public int getMaximumNumberOfSplits()
Description copied from class:SplittableIteratorThe maximum number of splits into which this iterator can be split up.- Specified by:
getMaximumNumberOfSplitsin classSplittableIterator<Long>- Returns:
- The maximum number of splits into which this iterator can be split up.
-
-