@Public public class NumberSequenceIterator extends SplittableIterator<Long>
NumberSequenceIterator
is an iterator that returns a sequence of numbers (as Long
)s. The iterator is splittable (as defined by SplittableIterator
, i.e., it can be
divided into multiple iterators that each return a subsequence of the number sequence.Constructor and Description |
---|
NumberSequenceIterator(long from,
long to)
Creates a new splittable iterator, returning the range [from, to].
|
Modifier and Type | Method and Description |
---|---|
long |
getCurrent() |
int |
getMaximumNumberOfSplits()
The maximum number of splits into which this iterator can be split up.
|
long |
getTo() |
boolean |
hasNext() |
Long |
next() |
void |
remove() |
NumberSequenceIterator[] |
split(int numPartitions)
Splits this iterator into a number disjoint iterators.
|
getSplit
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public NumberSequenceIterator(long from, long to)
from
- The first number returned by the iterator.to
- The last number returned by the iterator.public long getCurrent()
public long getTo()
public boolean hasNext()
public Long next()
public void remove()
public NumberSequenceIterator[] split(int numPartitions)
SplittableIterator
split
in class SplittableIterator<Long>
numPartitions
- The number of iterators to split into.public int getMaximumNumberOfSplits()
SplittableIterator
getMaximumNumberOfSplits
in class SplittableIterator<Long>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.