Package org.nasengolem.util.zip
Class Zip3<V1,V2,V3,I1 extends Iterable<V1>,I2 extends Iterable<V2>,I3 extends Iterable<V3>>
java.lang.Object
org.nasengolem.util.zip.Zip<org.jooq.lambda.tuple.Tuple3<V1,V2,V3>>
org.nasengolem.util.zip.Zip3<V1,V2,V3,I1,I2,I3>
- Type Parameters:
V1
- the type of elements in the first iterable.V2
- the type of elements in the second iterable.V3
- the type of elements in the third iterable.I1
- the type of the first iterable, which must be anIterable<V1>
.I2
- the type of the second iterable, which must be anIterable<V2>
.I3
- the type of the third iterable, which must be anIterable<V3>
.
- All Implemented Interfaces:
Iterable<org.jooq.lambda.tuple.Tuple3<V1,
,V2, V3>> Iterator<org.jooq.lambda.tuple.Tuple3<V1,
V2, V3>>
public class Zip3<V1,V2,V3,I1 extends Iterable<V1>,I2 extends Iterable<V2>,I3 extends Iterable<V3>>
extends Zip<org.jooq.lambda.tuple.Tuple3<V1,V2,V3>>
The
Zip3
class combines three iterables into a single iterable of triples (tuples).
It generates a sequence of Tuple3
objects, where each tuple contains one element from
each of the three iterables. If the iterables are of different lengths, the resulting sequence
stops when the shortest iterable is exhausted.
This functionality is inspired by the zip
function in Python.
For more information on the Python equivalent, see
Python zip documentation.
Since Java does not natively support tuples or pattern matching, this implementation
uses tuples from the org.jooq.lambda.tuple
package to fill that gap.
- Author:
- Paul Steinbach
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
Zip3
-
-
Method Details
-
hasNext
public boolean hasNext()Returnstrue
if all three iterables have more elements to iterate.- Returns:
true
if all three iterables have remaining elements, otherwisefalse
.
-
next
-