Skip to content

Commit

Permalink
Tuple40
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrimatti committed Aug 12, 2024
1 parent 532efb2 commit 53f16de
Show file tree
Hide file tree
Showing 50 changed files with 1,511 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fi.solita.utils</groupId>
<artifactId>functional-utils</artifactId>
<version>0.12.52</version>
<version>0.12.53</version>
<build>
<resources>
<resource>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/fi/solita/utils/functional/Apply40.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package fi.solita.utils.functional;

import java.io.Serializable;

/**
* java.util.function.Function but for 40 arguments
*/
public interface Apply40<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24,T25,T26,T27,T28,T29,T30,T31,T32,T33,T34,T35,T36,T37,T38,T39,T40,R> extends Serializable {
R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33, T34 t34, T35 t35, T36 t36, T37 t37, T38 t38, T39 t39, T40 t40);
}
43 changes: 33 additions & 10 deletions src/main/java/fi/solita/utils/functional/Collections.java

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/main/java/fi/solita/utils/functional/Compare.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,10 @@ public static final <K,V extends Comparable<? super V>> Ordering<Map.Entry<K,V>>
*/
@SuppressWarnings("unchecked")
public static final Ordering<Tuple._39<? extends Comparable<?>>> by_39 = (Ordering<Tuple._39<? extends Comparable<?>>>)(Object)by(Transformers.<Comparable<?>>_39());

/**
* Ordering for 40. element of a tuple.
*/
@SuppressWarnings("unchecked")
public static final Ordering<Tuple._40<? extends Comparable<?>>> by_40 = (Ordering<Tuple._40<? extends Comparable<?>>>)(Object)by(Transformers.<Comparable<?>>_40());
}
15 changes: 15 additions & 0 deletions src/main/java/fi/solita/utils/functional/Function.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,15 @@ public final R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9
};
}

public static final <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, R> Function40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, R> of(final Apply40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, R> apply) {
return new Function40<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, R>() {
@Override
public final R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22, T23 t23, T24 t24, T25 t25, T26 t26, T27 t27, T28 t28, T29 t29, T30 t30, T31 t31, T32 t32, T33 t33, T34 t34, T35 t35, T36 t36, T37 t37, T38 t38, T39 t39, T40 t40) {
return apply.apply(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24, t25, t26, t27, t28, t29, t30, t31, t32, t33, t34, t35, t36, t37, t38, t39, t40);
}
};
}

public static final <T1, T2> Function2<T1, T2, Void> consumer(final ApplyBiVoid<T1, T2> apply) {
return new Function2<T1, T2, Void>() {
@Override
Expand Down Expand Up @@ -967,6 +976,12 @@ public final R apply(Object p1, Object p2, Object p3, Object p4, Object p5, Obje
return ff.apply(replacePlaceholders(args, t, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39));
}
};
case 40: return (FR) new Function40<Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,R>() {
@Override
public final R apply(Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9, Object p10, Object p11, Object p12, Object p13, Object p14, Object p15, Object p16, Object p17, Object p18, Object p19, Object p20, Object p21, Object p22, Object p23, Object p24, Object p25, Object p26, Object p27, Object p28, Object p29, Object p30, Object p31, Object p32, Object p33, Object p34, Object p35, Object p36, Object p37, Object p38, Object p39, Object p40) {
return ff.apply(replacePlaceholders(args, t, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40));
}
};
}
throw new UnsupportedOperationException("Not implemented");
}
Expand Down
Loading

0 comments on commit 53f16de

Please sign in to comment.