Class Zip2<V1,V2,I1 extends Iterable<V1>,I2 extends Iterable<V2>>

java.lang.Object
org.nasengolem.util.zip.Zip<org.jooq.lambda.tuple.Tuple2<V1,V2>>
org.nasengolem.util.zip.Zip2<V1,V2,I1,I2>
Type Parameters:
V1 - the type of elements in the first iterable.
V2 - the type of elements in the second iterable.
I1 - the type of the first iterable, which must be an Iterable<V1>.
I2 - the type of the second iterable, which must be an Iterable<V2>.
All Implemented Interfaces:
Iterable<org.jooq.lambda.tuple.Tuple2<V1,V2>>, Iterator<org.jooq.lambda.tuple.Tuple2<V1,V2>>

public class Zip2<V1,V2,I1 extends Iterable<V1>,I2 extends Iterable<V2>> extends Zip<org.jooq.lambda.tuple.Tuple2<V1,V2>>
The Zip2 class combines two iterables into a single iterable of pairs (tuples). It generates a sequence of Tuple2 objects, where each tuple contains one element from the first iterable and one element from the second iterable. If the iterables are of different lengths, the resulting sequence stops when the shorter 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