public class ParallelIterator<Type1,Type2> extends Object implements Iterator<com.saperion.common.lang.encapsulation.Pair<Type1,Type2>>
Constructor and Description |
---|
ParallelIterator(Iterator<Type1> iterator1,
Iterator<Type2> iterator2)
Creates a
ParallelIterator that iterates over the given
iterators simultaneously. |
Modifier and Type | Method and Description |
---|---|
static <Type1,Type2> |
create(Iterator<Type1> iterator1,
Iterator<Type2> iterator2)
Convenience method that wraps the constructor call and lets the compiler determine the generic types.
|
boolean |
hasNext() |
com.saperion.common.lang.encapsulation.Pair<Type1,Type2> |
next()
The result will hold the result of the
Iterator.next() call of the first iterator first, then
the one of the second iterator. |
static <Type1,Type2> |
parallel(Iterable<Type1> iterable1,
Iterable<Type2> iterable2) |
void |
remove() |
public ParallelIterator(Iterator<Type1> iterator1, Iterator<Type2> iterator2)
ParallelIterator
that iterates over the given
iterators
simultaneously.iterator1
- the first iterator to iterate over. The return values of its Iterator.next()
method will be first in the result pair of the next()
method.iterator2
- the second iterator to iterate over. The return values of its Iterator.next()
method will be second in the result pair of the next()
method.public boolean hasNext()
hasNext
in interface Iterator<com.saperion.common.lang.encapsulation.Pair<Type1,Type2>>
public com.saperion.common.lang.encapsulation.Pair<Type1,Type2> next()
Iterator.next()
call of the first iterator first, then
the one of the second iterator.next
in interface Iterator<com.saperion.common.lang.encapsulation.Pair<Type1,Type2>>
public void remove()
remove
in interface Iterator<com.saperion.common.lang.encapsulation.Pair<Type1,Type2>>
public static <Type1,Type2> ParallelIterator<Type1,Type2> create(Iterator<Type1> iterator1, Iterator<Type2> iterator2)
public static <Type1,Type2> Iterable<com.saperion.common.lang.encapsulation.Pair<Type1,Type2>> parallel(Iterable<Type1> iterable1, Iterable<Type2> iterable2)
Copyright © 2016 SAPERION AG. All rights reserved.