/** * A converting function from Object array to {@link Tuple8} * * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @param <T4> The type of the fourth value. * @param <T5> The type of the fifth value. * @param <T6> The type of the sixth value. * @param <T7> The type of the seventh value. * @param <T8> The type of the eighth value. * @param <R> The type of the return value. * @param delegate the function to delegate to * * @return The unchecked conversion function to {@link Tuple8}. */ public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Function<Object[], R> fn8(final Function<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, R> delegate) { return objects -> delegate.apply(Tuples.<T1, T2, T3, T4, T5, T6, T7, T8>fn8().apply(objects)); }
Publisher<? extends T7> source7, Publisher<? extends T8> source8) { return zip(Tuples.fn8(), source1, source2, source3, source4, source5, source6, source7, source8);
@Test public void fn8() { Integer[] source = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8 }; Tuple8 tuple = Tuples.fn8().apply(source); assertThat(tuple.getT1()).isEqualTo(1); assertThat(tuple.getT2()).isEqualTo(2); assertThat(tuple.getT3()).isEqualTo(3); assertThat(tuple.getT4()).isEqualTo(4); assertThat(tuple.getT5()).isEqualTo(5); assertThat(tuple.getT6()).isEqualTo(6); assertThat(tuple.getT7()).isEqualTo(7); assertThat(tuple.getT8()).isEqualTo(8); }
@Test public void fn8Delegate() { Integer[] source = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8 }; Function<Tuple8<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer>, Integer> sum = t8 -> t8.getT8() + t8.getT7() + t8.getT6() + t8.getT5() + t8.getT4() + t8.getT3() + t8.getT2() + t8.getT1(); Integer result = Tuples.fn8(sum).apply(source); assertThat(result).isEqualTo(36); }
/** * A converting function from Object array to {@link Tuple8} * * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @param <T4> The type of the fourth value. * @param <T5> The type of the fifth value. * @param <T6> The type of the sixth value. * @param <T7> The type of the seventh value. * @param <T8> The type of the eighth value. * @param <R> The type of the return value. * @param delegate the function to delegate to * * @return The unchecked conversion function to {@link Tuple8}. */ public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Function<Object[], R> fn8(final Function<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, R> delegate) { return objects -> delegate.apply(Tuples.<T1, T2, T3, T4, T5, T6, T7, T8>fn8().apply(objects)); }
Publisher<? extends T7> source7, Publisher<? extends T8> source8) { return zip(Tuples.fn8(), source1, source2, source3, source4, source5, source6, source7, source8);