-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTuple4.java
More file actions
36 lines (27 loc) · 902 Bytes
/
Tuple4.java
File metadata and controls
36 lines (27 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.lambdaql;
import org.lambdaql.utils.Consumer4;
import org.lambdaql.utils.Function4;
import java.util.List;
public record Tuple4<T1, T2, T3, T4>(T1 t1, T2 t2, T3 t3, T4 t4) implements Tuple {
public static <T1, T2, T3, T4> Tuple4<T1, T2, T3, T4> of(T1 t1, T2 t2, T3 t3, T4 t4) {
return new Tuple4<>(t1, t2, t3, t4);
}
public T1 component1() { return t1; }
public T2 component2() { return t2; }
public T3 component3() { return t3; }
public T4 component4() { return t4; }
@Override
public List<Object> toList() {
return List.of(t1, t2, t3, t4);
}
@Override
public int arity() {
return 4;
}
public <R> R map(Function4<T1, T2, T3, T4, R> mapper) {
return mapper.apply(t1, t2, t3, t4);
}
public void forEach(Consumer4<T1, T2, T3, T4> action) {
action.accept(t1, t2, t3, t4);
}
}