Package org.apache.flink.util
Class SplittableIterator<T>
- java.lang.Object
-
- org.apache.flink.util.SplittableIterator<T>
-
- Type Parameters:
T
- The type of elements returned by the iterator.
- All Implemented Interfaces:
Serializable
,Iterator<T>
- Direct Known Subclasses:
LongValueSequenceIterator
,NumberSequenceIterator
@Public public abstract class SplittableIterator<T> extends Object implements Iterator<T>, Serializable
Abstract base class for iterators that can split themselves into multiple disjoint iterators. The union of these iterators returns the original iterator values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SplittableIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
getMaximumNumberOfSplits()
The maximum number of splits into which this iterator can be split up.Iterator<T>
getSplit(int num, int numPartitions)
Splits this iterator into n partitions and returns the i-th partition out of those.abstract Iterator<T>[]
split(int numPartitions)
Splits this iterator into a number disjoint iterators.-
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, hasNext, next, remove
-
-
-
-
Method Detail
-
split
public abstract Iterator<T>[] split(int numPartitions)
Splits this iterator into a number disjoint iterators. The union of these iterators returns the original iterator values.- Parameters:
numPartitions
- The number of iterators to split into.- Returns:
- An array with the split iterators.
-
getSplit
public Iterator<T> getSplit(int num, int numPartitions)
Splits this iterator into n partitions and returns the i-th partition out of those.- Parameters:
num
- The partition to return (i).numPartitions
- The number of partitions to split into (n).- Returns:
- The iterator for the partition.
-
getMaximumNumberOfSplits
public abstract int getMaximumNumberOfSplits()
The maximum number of splits into which this iterator can be split up.- Returns:
- The maximum number of splits into which this iterator can be split up.
-
-