Repository: groovy Updated Branches: refs/heads/master 885d8f7ec -> 374c8ee0c
GROOVY-8902: Add method `mapAll` to tuples(closes #832) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/374c8ee0 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/374c8ee0 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/374c8ee0 Branch: refs/heads/master Commit: 374c8ee0c21f0ad27cf3a40d339bfe160cdb6aee Parents: 885d8f7 Author: Daniel Sun <sun...@apache.org> Authored: Sun Nov 25 00:47:40 2018 +0800 Committer: Daniel Sun <sun...@apache.org> Committed: Sun Nov 25 00:47:40 2018 +0800 ---------------------------------------------------------------------- src/main/groovy/groovy/lang/Tuple0.java | 11 ++++++++ src/main/groovy/groovy/lang/Tuple1.java | 7 +++++ src/main/groovy/groovy/lang/Tuple10.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple11.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple12.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple13.java | 13 +++++++++ src/main/groovy/groovy/lang/Tuple14.java | 13 +++++++++ src/main/groovy/groovy/lang/Tuple15.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple16.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple2.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple3.java | 13 +++++++++ src/main/groovy/groovy/lang/Tuple4.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple5.java | 15 +++++++++++ src/main/groovy/groovy/lang/Tuple6.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple7.java | 16 +++++++++++ src/main/groovy/groovy/lang/Tuple8.java | 14 ++++++++++ src/main/groovy/groovy/lang/Tuple9.java | 14 ++++++++++ src/test/groovy/lang/TupleTest.java | 38 +++++++++++++++++++++++++++ 18 files changed, 266 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple0.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple0.java b/src/main/groovy/groovy/lang/Tuple0.java index 10bc91a..f46c8f9 100644 --- a/src/main/groovy/groovy/lang/Tuple0.java +++ b/src/main/groovy/groovy/lang/Tuple0.java @@ -178,6 +178,17 @@ public final class Tuple0 extends Tuple { return function.apply(); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <R> Tuple0 mapAll(Function0<? extends R> function) { + if (null != function) { + function.apply(); + } + + return INSTANCE; + } + @Override public Tuple0 clone() { return INSTANCE; http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple1.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple1.java b/src/main/groovy/groovy/lang/Tuple1.java index c76c6d2..9ecc6d0 100644 --- a/src/main/groovy/groovy/lang/Tuple1.java +++ b/src/main/groovy/groovy/lang/Tuple1.java @@ -216,6 +216,13 @@ public final class Tuple1<T1> extends Tuple { return new Tuple1<>(function.apply(v1)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1> Tuple1<U1> mapAll(Function1<? super T1, Tuple1<U1>> function) { + return function.apply(v1); + } + @Override public Tuple1<T1> clone() { return new Tuple1<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple10.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple10.java b/src/main/groovy/groovy/lang/Tuple10.java index 6670375..55ee715 100644 --- a/src/main/groovy/groovy/lang/Tuple10.java +++ b/src/main/groovy/groovy/lang/Tuple10.java @@ -458,6 +458,20 @@ public final class Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends Tupl return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, function.apply(v10)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10> Tuple10<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10> mapAll(Function10<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, Tuple10<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10> Tuple10<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10) { + return new Tuple10<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10)); + } + @Override public Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> clone() { return new Tuple10<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple11.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple11.java b/src/main/groovy/groovy/lang/Tuple11.java index b160e42..96baab0 100644 --- a/src/main/groovy/groovy/lang/Tuple11.java +++ b/src/main/groovy/groovy/lang/Tuple11.java @@ -485,6 +485,20 @@ public final class Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, function.apply(v11)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11> Tuple11<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11> mapAll(Function11<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, Tuple11<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11> Tuple11<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10, Function1<? super T11, ? extends U11> function11) { + return new Tuple11<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10), function11.apply(v11)); + } + @Override public Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> clone() { return new Tuple11<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple12.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple12.java b/src/main/groovy/groovy/lang/Tuple12.java index e77aedd..7eee60e 100644 --- a/src/main/groovy/groovy/lang/Tuple12.java +++ b/src/main/groovy/groovy/lang/Tuple12.java @@ -513,6 +513,20 @@ public final class Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> ex return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, function.apply(v12)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12> Tuple12<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12> mapAll(Function12<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, Tuple12<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12> Tuple12<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10, Function1<? super T11, ? extends U11> function11, Function1<? super T12, ? extends U12> function12) { + return new Tuple12<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10), function11.apply(v11), function12.apply(v12)); + } + @Override public Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> clone() { return new Tuple12<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple13.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple13.java b/src/main/groovy/groovy/lang/Tuple13.java index a6dadcb..70a5189 100644 --- a/src/main/groovy/groovy/lang/Tuple13.java +++ b/src/main/groovy/groovy/lang/Tuple13.java @@ -539,6 +539,19 @@ public final class Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T1 return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, function.apply(v13)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13> Tuple13<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13> mapAll(Function13<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? super T13, Tuple13<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13> Tuple13<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10, Function1<? super T11, ? extends U11> function11, Function1<? super T12, ? extends U12> function12, Function1<? super T13, ? extends U13> function13) { + return new Tuple13<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10), function11.apply(v11), function12.apply(v12), function13.apply(v13)); + } @Override public Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> clone() { http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple14.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple14.java b/src/main/groovy/groovy/lang/Tuple14.java index 91b403f..a7c9db1 100644 --- a/src/main/groovy/groovy/lang/Tuple14.java +++ b/src/main/groovy/groovy/lang/Tuple14.java @@ -565,6 +565,19 @@ public final class Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T1 return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, function.apply(v14)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14> Tuple14<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14> mapAll(Function14<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? super T13, ? super T14, Tuple14<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14> Tuple14<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10, Function1<? super T11, ? extends U11> function11, Function1<? super T12, ? extends U12> function12, Function1<? super T13, ? extends U13> function13, Function1<? super T14, ? extends U14> function14) { + return new Tuple14<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10), function11.apply(v11), function12.apply(v12), function13.apply(v13), function14.apply(v14)); + } @Override public Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> clone() { http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple15.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple15.java b/src/main/groovy/groovy/lang/Tuple15.java index 7399ec8..1c3c67b 100644 --- a/src/main/groovy/groovy/lang/Tuple15.java +++ b/src/main/groovy/groovy/lang/Tuple15.java @@ -592,6 +592,20 @@ public final class Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T1 return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, function.apply(v15)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15> Tuple15<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15> mapAll(Function15<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? super T13, ? super T14, ? super T15, Tuple15<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15> Tuple15<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10, Function1<? super T11, ? extends U11> function11, Function1<? super T12, ? extends U12> function12, Function1<? super T13, ? extends U13> function13, Function1<? super T14, ? extends U14> function14, Function1<? super T15, ? extends U15> function15) { + return new Tuple15<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10), function11.apply(v11), function12.apply(v12), function13.apply(v13), function14.apply(v14), function15.apply(v15)); + } + @Override public Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> clone() { return new Tuple15<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple16.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple16.java b/src/main/groovy/groovy/lang/Tuple16.java index 22446ab..e5532fa 100644 --- a/src/main/groovy/groovy/lang/Tuple16.java +++ b/src/main/groovy/groovy/lang/Tuple16.java @@ -613,6 +613,20 @@ public final class Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T1 return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, function.apply(v16)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16> Tuple16<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16> mapAll(Function16<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? super T10, ? super T11, ? super T12, ? super T13, ? super T14, ? super T15, ? super T16, Tuple16<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16> Tuple16<U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9, Function1<? super T10, ? extends U10> function10, Function1<? super T11, ? extends U11> function11, Function1<? super T12, ? extends U12> function12, Function1<? super T13, ? extends U13> function13, Function1<? super T14, ? extends U14> function14, Function1<? super T15, ? extends U15> function15, Function1<? super T16, ? extends U16> function16) { + return new Tuple16<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9), function10.apply(v10), function11.apply(v11), function12.apply(v12), function13.apply(v13), function14.apply(v14), function15.apply(v15), function16.apply(v16)); + } + @Override public Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> clone() { return new Tuple16<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple2.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple2.java b/src/main/groovy/groovy/lang/Tuple2.java index 783f2a1..baeec81 100644 --- a/src/main/groovy/groovy/lang/Tuple2.java +++ b/src/main/groovy/groovy/lang/Tuple2.java @@ -278,6 +278,20 @@ public final class Tuple2<T1, T2> extends Tuple { return new Tuple2<>(v1, function.apply(v2)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2> Tuple2<U1, U2> mapAll(Function2<? super T1, ? super T2, Tuple2<U1, U2>> function) { + return function.apply(v1, v2); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2> Tuple2<U1, U2> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2) { + return new Tuple2<>(function1.apply(v1), function2.apply(v2)); + } + @Override public Tuple2<T1, T2> clone() { return new Tuple2<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple3.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple3.java b/src/main/groovy/groovy/lang/Tuple3.java index 370a0cc..e7b1ead 100644 --- a/src/main/groovy/groovy/lang/Tuple3.java +++ b/src/main/groovy/groovy/lang/Tuple3.java @@ -282,6 +282,19 @@ public final class Tuple3<T1, T2, T3> extends Tuple { return new Tuple3<>(v1, v2, function.apply(v3)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3> Tuple3<U1, U2, U3> mapAll(Function3<? super T1, ? super T2, ? super T3, Tuple3<U1, U2, U3>> function) { + return function.apply(v1, v2, v3); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3> Tuple3<U1, U2, U3> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3) { + return new Tuple3<>(function1.apply(v1), function2.apply(v2), function3.apply(v3)); + } @Override public Tuple3<T1, T2, T3> clone() { http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple4.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple4.java b/src/main/groovy/groovy/lang/Tuple4.java index cc2b9e3..0ac5245 100644 --- a/src/main/groovy/groovy/lang/Tuple4.java +++ b/src/main/groovy/groovy/lang/Tuple4.java @@ -315,6 +315,20 @@ public final class Tuple4<T1, T2, T3, T4> extends Tuple { return new Tuple4<>(v1, v2, v3, function.apply(v4)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4> Tuple4<U1, U2, U3, U4> mapAll(Function4<? super T1, ? super T2, ? super T3, ? super T4, Tuple4<U1, U2, U3, U4>> function) { + return function.apply(v1, v2, v3, v4); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4> Tuple4<U1, U2, U3, U4> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4) { + return new Tuple4<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4)); + } + @Override public Tuple4<T1, T2, T3, T4> clone() { return new Tuple4<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple5.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple5.java b/src/main/groovy/groovy/lang/Tuple5.java index cbeaf6f..e7c4f43 100644 --- a/src/main/groovy/groovy/lang/Tuple5.java +++ b/src/main/groovy/groovy/lang/Tuple5.java @@ -347,6 +347,21 @@ public final class Tuple5<T1, T2, T3, T4, T5> extends Tuple { return new Tuple5<>(v1, v2, v3, v4, function.apply(v5)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5> Tuple5<U1, U2, U3, U4, U5> mapAll(Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, Tuple5<U1, U2, U3, U4, U5>> function) { + return function.apply(v1, v2, v3, v4, v5); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5> Tuple5<U1, U2, U3, U4, U5> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5) { + return new Tuple5<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5)); + } + + @Override public Tuple5<T1, T2, T3, T4, T5> clone() { return new Tuple5<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple6.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple6.java b/src/main/groovy/groovy/lang/Tuple6.java index 055f41e..8c5620f 100644 --- a/src/main/groovy/groovy/lang/Tuple6.java +++ b/src/main/groovy/groovy/lang/Tuple6.java @@ -379,6 +379,20 @@ public final class Tuple6<T1, T2, T3, T4, T5, T6> extends Tuple { return new Tuple6<>(v1, v2, v3, v4, v5, function.apply(v6)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6> Tuple6<U1, U2, U3, U4, U5, U6> mapAll(Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, Tuple6<U1, U2, U3, U4, U5, U6>> function) { + return function.apply(v1, v2, v3, v4, v5, v6); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6> Tuple6<U1, U2, U3, U4, U5, U6> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6) { + return new Tuple6<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6)); + } + @Override public Tuple6<T1, T2, T3, T4, T5, T6> clone() { return new Tuple6<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple7.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple7.java b/src/main/groovy/groovy/lang/Tuple7.java index 95fc259..e865388 100644 --- a/src/main/groovy/groovy/lang/Tuple7.java +++ b/src/main/groovy/groovy/lang/Tuple7.java @@ -411,6 +411,22 @@ public final class Tuple7<T1, T2, T3, T4, T5, T6, T7> extends Tuple { return new Tuple7<>(v1, v2, v3, v4, v5, v6, function.apply(v7)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7> Tuple7<U1, U2, U3, U4, U5, U6, U7> mapAll(Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, Tuple7<U1, U2, U3, U4, U5, U6, U7>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7> Tuple7<U1, U2, U3, U4, U5, U6, U7> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7) { + return new Tuple7<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7)); + } + + + @Override public Tuple7<T1, T2, T3, T4, T5, T6, T7> clone() { return new Tuple7<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple8.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple8.java b/src/main/groovy/groovy/lang/Tuple8.java index e672b24..a1e8a03 100644 --- a/src/main/groovy/groovy/lang/Tuple8.java +++ b/src/main/groovy/groovy/lang/Tuple8.java @@ -443,6 +443,20 @@ public final class Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> extends Tuple { return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, function.apply(v8)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8> Tuple8<U1, U2, U3, U4, U5, U6, U7, U8> mapAll(Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, Tuple8<U1, U2, U3, U4, U5, U6, U7, U8>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8> Tuple8<U1, U2, U3, U4, U5, U6, U7, U8> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8) { + return new Tuple8<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8)); + } + @Override public Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> clone() { return new Tuple8<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/main/groovy/groovy/lang/Tuple9.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/groovy/lang/Tuple9.java b/src/main/groovy/groovy/lang/Tuple9.java index dada7b0..ab8b39b 100644 --- a/src/main/groovy/groovy/lang/Tuple9.java +++ b/src/main/groovy/groovy/lang/Tuple9.java @@ -476,6 +476,20 @@ public final class Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends Tuple { return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, v8, function.apply(v9)); } + /** + * Maps the attributes of this tuple using a mapper function. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9> Tuple9<U1, U2, U3, U4, U5, U6, U7, U8, U9> mapAll(Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, Tuple9<U1, U2, U3, U4, U5, U6, U7, U8, U9>> function) { + return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9); + } + + /** + * Maps the attributes of this tuple using mapper functions. + */ + public final <U1, U2, U3, U4, U5, U6, U7, U8, U9> Tuple9<U1, U2, U3, U4, U5, U6, U7, U8, U9> mapAll(Function1<? super T1, ? extends U1> function1, Function1<? super T2, ? extends U2> function2, Function1<? super T3, ? extends U3> function3, Function1<? super T4, ? extends U4> function4, Function1<? super T5, ? extends U5> function5, Function1<? super T6, ? extends U6> function6, Function1<? super T7, ? extends U7> function7, Function1<? super T8, ? extends U8> function8, Function1<? super T9, ? extends U9> function9) { + return new Tuple9<>(function1.apply(v1), function2.apply(v2), function3.apply(v3), function4.apply(v4), function5.apply(v5), function6.apply(v6), function7.apply(v7), function8.apply(v8), function9.apply(v9)); + } + @Override public Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> clone() { return new Tuple9<>(this); http://git-wip-us.apache.org/repos/asf/groovy/blob/374c8ee0/src/test/groovy/lang/TupleTest.java ---------------------------------------------------------------------- diff --git a/src/test/groovy/lang/TupleTest.java b/src/test/groovy/lang/TupleTest.java index 1e49736..0a84ca3 100644 --- a/src/test/groovy/lang/TupleTest.java +++ b/src/test/groovy/lang/TupleTest.java @@ -624,4 +624,42 @@ public class TupleTest extends GroovyTestCase { assert false: e.getMessage(); } } + + public void testMapAll() { + assertEquals(tuple(), tuple().mapAll(() -> null)); + assertEquals(tuple(2), tuple(1).mapAll((v1) -> tuple(v1 + 1))); + + assertEquals(tuple(2, 3), tuple(1, 2).mapAll((v1, v2) -> tuple(v1 + 1, v2 + 1))); + assertEquals(tuple(2, 3, 4), tuple(1, 2, 3).mapAll((v1, v2, v3) -> tuple(v1 + 1, v2 + 1, v3 + 1))); + assertEquals(tuple(2, 3, 4, 5), tuple(1, 2, 3, 4).mapAll((v1, v2, v3, v4) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6), tuple(1, 2, 3, 4, 5).mapAll((v1, v2, v3, v4, v5) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7), tuple(1, 2, 3, 4, 5, 6).mapAll((v1, v2, v3, v4, v5, v6) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8), tuple(1, 2, 3, 4, 5, 6, 7).mapAll((v1, v2, v3, v4, v5, v6, v7) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9), tuple(1, 2, 3, 4, 5, 6, 7, 8).mapAll((v1, v2, v3, v4, v5, v6, v7, v8) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9, 10), tuple(1, 2, 3, 4, 5, 6, 7, 8, 9).mapAll((v1, v2, v3, v4, v5, v6, v7, v8, v9) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1, v9 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9, 10, 11), tuple(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).mapAll((v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1, v9 + 1, v10 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), tuple(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).mapAll((v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1, v9 + 1, v10 + 1, v11 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), tuple(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).mapAll((v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1, v9 + 1, v10 + 1, v11 + 1, v12 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14), tuple(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13).mapAll((v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1, v9 + 1, v10 + 1, v11 + 1, v12 + 1, v13 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), tuple(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14).mapAll((v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1, v9 + 1, v10 + 1, v11 + 1, v12 + 1, v13 + 1, v14 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), tuple(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15).mapAll((v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1, v9 + 1, v10 + 1, v11 + 1, v12 + 1, v13 + 1, v14 + 1, v15 + 1))); + assertEquals(tuple(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), tuple(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16).mapAll((v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) -> tuple(v1 + 1, v2 + 1, v3 + 1, v4 + 1, v5 + 1, v6 + 1, v7 + 1, v8 + 1, v9 + 1, v10 + 1, v11 + 1, v12 + 1, v13 + 1, v14 + 1, v15 + 1, v16 + 1))); + + assertEquals(tuple(2,3), tuple(1,2).mapAll(v1 -> v1 + 1, v2 -> v2 + 1)); + assertEquals(tuple(2,3,4), tuple(1,2,3).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1)); + assertEquals(tuple(2,3,4,5), tuple(1,2,3,4).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1)); + assertEquals(tuple(2,3,4,5,6), tuple(1,2,3,4,5).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1)); + assertEquals(tuple(2,3,4,5,6,7), tuple(1,2,3,4,5,6).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8), tuple(1,2,3,4,5,6,7).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9), tuple(1,2,3,4,5,6,7,8).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9,10), tuple(1,2,3,4,5,6,7,8,9).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1, v9 -> v9 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9,10,11), tuple(1,2,3,4,5,6,7,8,9,10).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1, v9 -> v9 + 1, v10 -> v10 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9,10,11,12), tuple(1,2,3,4,5,6,7,8,9,10,11).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1, v9 -> v9 + 1, v10 -> v10 + 1, v11 -> v11 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9,10,11,12,13), tuple(1,2,3,4,5,6,7,8,9,10,11,12).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1, v9 -> v9 + 1, v10 -> v10 + 1, v11 -> v11 + 1, v12 -> v12 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9,10,11,12,13,14), tuple(1,2,3,4,5,6,7,8,9,10,11,12,13).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1, v9 -> v9 + 1, v10 -> v10 + 1, v11 -> v11 + 1, v12 -> v12 + 1, v13 -> v13 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9,10,11,12,13,14,15), tuple(1,2,3,4,5,6,7,8,9,10,11,12,13,14).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1, v9 -> v9 + 1, v10 -> v10 + 1, v11 -> v11 + 1, v12 -> v12 + 1, v13 -> v13 + 1, v14 -> v14 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), tuple(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1, v9 -> v9 + 1, v10 -> v10 + 1, v11 -> v11 + 1, v12 -> v12 + 1, v13 -> v13 + 1, v14 -> v14 + 1, v15 -> v15 + 1)); + assertEquals(tuple(2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17), tuple(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16).mapAll(v1 -> v1 + 1, v2 -> v2 + 1, v3 -> v3 + 1, v4 -> v4 + 1, v5 -> v5 + 1, v6 -> v6 + 1, v7 -> v7 + 1, v8 -> v8 + 1, v9 -> v9 + 1, v10 -> v10 + 1, v11 -> v11 + 1, v12 -> v12 + 1, v13 -> v13 + 1, v14 -> v14 + 1, v15 -> v15 + 1, v16 -> v16 + 1)); + + } }