From f652e290b9e75f6766ec15c9e6a9a2a3bb4462e3 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Wed, 21 Oct 2020 16:00:54 +0200 Subject: [PATCH] [jOOQ/jOOQ#10775] Add Rows.collecting() and Rows.collectingArray() methods to create Row[N] arrays and lists --- jOOQ/src/main/java/org/jooq/Rows.java | 1125 +++++++++++++++++++++++++ 1 file changed, 1125 insertions(+) create mode 100644 jOOQ/src/main/java/org/jooq/Rows.java diff --git a/jOOQ/src/main/java/org/jooq/Rows.java b/jOOQ/src/main/java/org/jooq/Rows.java new file mode 100644 index 0000000000..f355eaf74b --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/Rows.java @@ -0,0 +1,1125 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collector; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.jooq.impl.DSL; + +/** + * An auxiliary class for constructing {@link Row} collections. + * + * @author Dmitry Baev + * @author Lukas Eder + */ +public final class Rows { + + + + /** + * Create a collector that can collect into an array of {@link RowN}. + */ + @SafeVarargs + public static Collector collectingArray( + Function... functions + ) { + return Collectors.collectingAndThen(collecting(functions), l -> l.toArray(RowN[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link RowN}. + */ + @SafeVarargs + public static Collector> collecting( + Function... functions + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(Stream.of(functions).map(f -> f.apply(t)).toArray())), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + + + /** + * Create a collector that can collect into an array of {@link Row1}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1 + ) { + return Collectors.collectingAndThen(collecting(f1), l -> l.toArray(Row1[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row1}. + */ + public static Collector>> collecting( + Function f1 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row2}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2 + ) { + return Collectors.collectingAndThen(collecting(f1, f2), l -> l.toArray(Row2[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row2}. + */ + public static Collector>> collecting( + Function f1, + Function f2 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row3}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3), l -> l.toArray(Row3[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row3}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row4}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4), l -> l.toArray(Row4[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row4}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row5}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5), l -> l.toArray(Row5[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row5}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row6}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6), l -> l.toArray(Row6[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row6}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row7}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7), l -> l.toArray(Row7[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row7}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row8}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8), l -> l.toArray(Row8[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row8}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row9}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9), l -> l.toArray(Row9[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row9}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row10}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10), l -> l.toArray(Row10[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row10}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row11}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11), l -> l.toArray(Row11[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row11}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row12}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12), l -> l.toArray(Row12[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row12}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row13}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13), l -> l.toArray(Row13[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row13}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row14}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14), l -> l.toArray(Row14[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row14}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row15}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15), l -> l.toArray(Row15[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row15}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t), f15.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row16}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16), l -> l.toArray(Row16[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row16}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t), f15.apply(t), f16.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row17}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17), l -> l.toArray(Row17[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row17}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t), f15.apply(t), f16.apply(t), f17.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row18}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18), l -> l.toArray(Row18[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row18}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t), f15.apply(t), f16.apply(t), f17.apply(t), f18.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row19}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18, + Function f19 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19), l -> l.toArray(Row19[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row19}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18, + Function f19 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t), f15.apply(t), f16.apply(t), f17.apply(t), f18.apply(t), f19.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row20}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18, + Function f19, + Function f20 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20), l -> l.toArray(Row20[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row20}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18, + Function f19, + Function f20 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t), f15.apply(t), f16.apply(t), f17.apply(t), f18.apply(t), f19.apply(t), f20.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row21}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18, + Function f19, + Function f20, + Function f21 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21), l -> l.toArray(Row21[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row21}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18, + Function f19, + Function f20, + Function f21 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t), f15.apply(t), f16.apply(t), f17.apply(t), f18.apply(t), f19.apply(t), f20.apply(t), f21.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + /** + * Create a collector that can collect into an array of {@link Row22}. + */ + @SuppressWarnings("unchecked") + public static Collector[]> collectingArray( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18, + Function f19, + Function f20, + Function f21, + Function f22 + ) { + return Collectors.collectingAndThen(collecting(f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22), l -> l.toArray(Row22[]::new)); + } + + /** + * Create a collector that can collect into a list of {@link Row22}. + */ + public static Collector>> collecting( + Function f1, + Function f2, + Function f3, + Function f4, + Function f5, + Function f6, + Function f7, + Function f8, + Function f9, + Function f10, + Function f11, + Function f12, + Function f13, + Function f14, + Function f15, + Function f16, + Function f17, + Function f18, + Function f19, + Function f20, + Function f21, + Function f22 + ) { + return Collector.of( + ArrayList::new, + (l, t) -> l.add(DSL.row(f1.apply(t), f2.apply(t), f3.apply(t), f4.apply(t), f5.apply(t), f6.apply(t), f7.apply(t), f8.apply(t), f9.apply(t), f10.apply(t), f11.apply(t), f12.apply(t), f13.apply(t), f14.apply(t), f15.apply(t), f16.apply(t), f17.apply(t), f18.apply(t), f19.apply(t), f20.apply(t), f21.apply(t), f22.apply(t))), + (t1, t2) -> { + t1.addAll(t2); + return t1; + } + ); + } + + + + +}