groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [5/8] groovy git commit: GROOVY-8874: Refine tuples to support functional programming better(closes #821)
Date Mon, 12 Nov 2018 16:43:38 GMT
http://git-wip-us.apache.org/repos/asf/groovy/blob/3ac1abcd/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 04f414e..30793a2 100644
--- a/src/main/groovy/groovy/lang/Tuple4.java
+++ b/src/main/groovy/groovy/lang/Tuple4.java
@@ -19,6 +19,9 @@
 
 package groovy.lang;
 
+import groovy.util.function.Function1;
+import groovy.util.function.Function4;
+
 /**
  * Represents a list of 4 typed Objects.
  *
@@ -26,54 +29,294 @@ package groovy.lang;
  */
 public class Tuple4<T1, T2, T3, T4> extends Tuple {
     private static final long serialVersionUID = -7788878731471377207L;
-    private final T1 first;
-    private final T2 second;
-    private final T3 third;
-    private final T4 fourth;
-
-    public Tuple4(T1 first, T2 second, T3 third, T4 fourth) {
-        super(first, second, third, fourth);
+    private final T1 v1;
+    private final T2 v2;
+    private final T3 v3;
+    private final T4 v4;
 
-        this.first = first;
-        this.second = second;
-        this.third = third;
-        this.fourth = fourth;
-    }
+    public Tuple4(T1 v1, T2 v2, T3 v3, T4 v4) {
+        super(v1, v2, v3, v4);
 
-    @Override
-    public Object get(int index) {
-        switch (index) {
-            case 0:
-                return first;
-            case 1:
-                return second;
-            case 2:
-                return third;
-            case 3:
-                return fourth;
-            default:
-                throw new IndexOutOfBoundsException("index: " + index);
-        }
+        this.v1 = v1;
+        this.v2 = v2;
+        this.v3 = v3;
+        this.v4 = v4;
     }
 
-    @Override
-    public int size() {
-        return 4;
+    public Tuple4(Tuple4<T1, T2, T3, T4> tuple) {
+        this(tuple.v1, tuple.v2, tuple.v3, tuple.v4);
     }
 
+    @Deprecated
     public T1 getFirst() {
-        return first;
+        return v1;
     }
 
+    @Deprecated
     public T2 getSecond() {
-        return second;
+        return v2;
     }
 
+    @Deprecated
     public T3 getThird() {
-        return third;
+        return v3;
     }
 
+    @Deprecated
     public T4 getFourth() {
-        return fourth;
+        return v4;
+    }
+
+    public T1 v1() {
+        return v1;
+    }
+
+    public T2 v2() {
+        return v2;
+    }
+
+    public T3 v3() {
+        return v3;
+    }
+
+    public T4 v4() {
+        return v4;
+    }
+
+
+    /**
+     * Concatenate a value to this tuple.
+     */
+    public final <T5> Tuple5<T1, T2, T3, T4, T5> concat(T5 value) {
+        return new Tuple5<>(v1, v2, v3, v4, value);
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5> Tuple5<T1, T2, T3, T4, T5> concat(Tuple1<T5> tuple) {
+        return new Tuple5<>(v1, v2, v3, v4, tuple.v1());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(Tuple2<T5, T6> tuple) {
+        return new Tuple6<>(v1, v2, v3, v4, tuple.v1(), tuple.v2());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple3<T5, T6, T7> tuple) {
+        return new Tuple7<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple4<T5, T6, T7, T8> tuple) {
+        return new Tuple8<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple5<T5, T6, T7, T8, T9> tuple) {
+        return new Tuple9<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple6<T5, T6, T7, T8, T9, T10> tuple) {
+        return new Tuple10<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple7<T5, T6, T7, T8, T9, T10, T11> tuple) {
+        return new Tuple11<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple8<T5, T6, T7, T8, T9, T10, T11, T12> tuple) {
+        return new Tuple12<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8, T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple9<T5, T6, T7, T8, T9, T10, T11, T12, T13> tuple) {
+        return new Tuple13<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple10<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> tuple) {
+        return new Tuple14<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple11<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> tuple) {
+        return new Tuple15<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10(), tuple.v11());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple12<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> tuple) {
+        return new Tuple16<>(v1, v2, v3, v4, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10(), tuple.v11(), tuple.v12());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 0 and 4.
+     */
+    public final Tuple2<Tuple0, Tuple4<T1, T2, T3, T4>> split0() {
+        return new Tuple2<>(limit0(), skip0());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 1 and 3.
+     */
+    public final Tuple2<Tuple1<T1>, Tuple3<T2, T3, T4>> split1() {
+        return new Tuple2<>(limit1(), skip1());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 2 and 2.
+     */
+    public final Tuple2<Tuple2<T1, T2>, Tuple2<T3, T4>> split2() {
+        return new Tuple2<>(limit2(), skip2());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 3 and 1.
+     */
+    public final Tuple2<Tuple3<T1, T2, T3>, Tuple1<T4>> split3() {
+        return new Tuple2<>(limit3(), skip3());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 4 and 0.
+     */
+    public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple0> split4() {
+        return new Tuple2<>(limit4(), skip4());
+    }
+
+    /**
+     * Limit this tuple to degree 0.
+     */
+    public final Tuple0 limit0() {
+        return new Tuple0();
+    }
+
+    /**
+     * Limit this tuple to degree 1.
+     */
+    public final Tuple1<T1> limit1() {
+        return new Tuple1<>(v1);
+    }
+
+    /**
+     * Limit this tuple to degree 2.
+     */
+    public final Tuple2<T1, T2> limit2() {
+        return new Tuple2<>(v1, v2);
+    }
+
+    /**
+     * Limit this tuple to degree 3.
+     */
+    public final Tuple3<T1, T2, T3> limit3() {
+        return new Tuple3<>(v1, v2, v3);
+    }
+
+    /**
+     * Limit this tuple to degree 4.
+     */
+    public final Tuple4<T1, T2, T3, T4> limit4() {
+        return this;
+    }
+
+    /**
+     * Skip 0 degrees from this tuple.
+     */
+    public final Tuple4<T1, T2, T3, T4> skip0() {
+        return this;
+    }
+
+    /**
+     * Skip 1 degrees from this tuple.
+     */
+    public final Tuple3<T2, T3, T4> skip1() {
+        return new Tuple3<>(v2, v3, v4);
+    }
+
+    /**
+     * Skip 2 degrees from this tuple.
+     */
+    public final Tuple2<T3, T4> skip2() {
+        return new Tuple2<>(v3, v4);
+    }
+
+    /**
+     * Skip 3 degrees from this tuple.
+     */
+    public final Tuple1<T4> skip3() {
+        return new Tuple1<>(v4);
+    }
+
+    /**
+     * Skip 4 degrees from this tuple.
+     */
+    public final Tuple0 skip4() {
+        return new Tuple0();
+    }
+
+    /**
+     * Apply this tuple as arguments to a function.
+     */
+    public final <R> R map(Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> function) {
+        return function.apply(v1, v2, v3, v4);
+    }
+
+    /**
+     * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U1> Tuple4<U1, T2, T3, T4> map1(Function1<? super T1, ? extends U1> function) {
+        return new Tuple4<>(function.apply(v1), v2, v3, v4);
+    }
+
+    /**
+     * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U2> Tuple4<T1, U2, T3, T4> map2(Function1<? super T2, ? extends U2> function) {
+        return new Tuple4<>(v1, function.apply(v2), v3, v4);
+    }
+
+    /**
+     * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U3> Tuple4<T1, T2, U3, T4> map3(Function1<? super T3, ? extends U3> function) {
+        return new Tuple4<>(v1, v2, function.apply(v3), v4);
+    }
+
+    /**
+     * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U4> Tuple4<T1, T2, T3, U4> map4(Function1<? super T4, ? extends U4> function) {
+        return new Tuple4<>(v1, v2, v3, function.apply(v4));
+    }
+
+    @Override
+    public Tuple4<T1, T2, T3, T4> clone() {
+        return new Tuple4<>(this);
     }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/3ac1abcd/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 ee9c802..a1dc209 100644
--- a/src/main/groovy/groovy/lang/Tuple5.java
+++ b/src/main/groovy/groovy/lang/Tuple5.java
@@ -19,6 +19,9 @@
 
 package groovy.lang;
 
+import groovy.util.function.Function1;
+import groovy.util.function.Function5;
+
 /**
  * Represents a list of 5 typed Objects.
  *
@@ -26,62 +29,326 @@ package groovy.lang;
  */
 public class Tuple5<T1, T2, T3, T4, T5> extends Tuple {
     private static final long serialVersionUID = 6722094358774027115L;
-    private final T1 first;
-    private final T2 second;
-    private final T3 third;
-    private final T4 fourth;
-    private final T5 fifth;
-
-    public Tuple5(T1 first, T2 second, T3 third, T4 fourth, T5 fifth) {
-        super(first, second, third, fourth, fifth);
+    private final T1 v1;
+    private final T2 v2;
+    private final T3 v3;
+    private final T4 v4;
+    private final T5 v5;
 
-        this.first = first;
-        this.second = second;
-        this.third = third;
-        this.fourth = fourth;
-        this.fifth = fifth;
-    }
+    public Tuple5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) {
+        super(v1, v2, v3, v4, v5);
 
-    @Override
-    public Object get(int index) {
-        switch (index) {
-            case 0:
-                return first;
-            case 1:
-                return second;
-            case 2:
-                return third;
-            case 3:
-                return fourth;
-            case 4:
-                return fifth;
-            default:
-                throw new IndexOutOfBoundsException("index: " + index);
-        }
+        this.v1 = v1;
+        this.v2 = v2;
+        this.v3 = v3;
+        this.v4 = v4;
+        this.v5 = v5;
     }
 
-    @Override
-    public int size() {
-        return 5;
+    public Tuple5(Tuple5<T1, T2, T3, T4, T5> tuple) {
+        this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5);
     }
 
+    @Deprecated
     public T1 getFirst() {
-        return first;
+        return v1;
     }
 
+    @Deprecated
     public T2 getSecond() {
-        return second;
+        return v2;
     }
 
+    @Deprecated
     public T3 getThird() {
-        return third;
+        return v3;
     }
 
+    @Deprecated
     public T4 getFourth() {
-        return fourth;
+        return v4;
     }
 
+    @Deprecated
     public T5 getFifth() {
-        return fifth;
+        return v5;
+    }
+
+    public T1 v1() {
+        return v1;
+    }
+
+    public T2 v2() {
+        return v2;
+    }
+
+    public T3 v3() {
+        return v3;
+    }
+
+    public T4 v4() {
+        return v4;
+    }
+
+    public T5 v5() {
+        return v5;
+    }
+
+
+    /**
+     * Concatenate a value to this tuple.
+     */
+    public final <T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(T6 value) {
+        return new Tuple6<>(v1, v2, v3, v4, v5, value);
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6> Tuple6<T1, T2, T3, T4, T5, T6> concat(Tuple1<T6> tuple) {
+        return new Tuple6<>(v1, v2, v3, v4, v5, tuple.v1());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple2<T6, T7> tuple) {
+        return new Tuple7<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple3<T6, T7, T8> tuple) {
+        return new Tuple8<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple4<T6, T7, T8, T9> tuple) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple5<T6, T7, T8, T9, T10> tuple) {
+        return new Tuple10<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple6<T6, T7, T8, T9, T10, T11> tuple) {
+        return new Tuple11<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple7<T6, T7, T8, T9, T10, T11, T12> tuple) {
+        return new Tuple12<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8, T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple8<T6, T7, T8, T9, T10, T11, T12, T13> tuple) {
+        return new Tuple13<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8, T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple9<T6, T7, T8, T9, T10, T11, T12, T13, T14> tuple) {
+        return new Tuple14<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple10<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> tuple) {
+        return new Tuple15<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple11<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> tuple) {
+        return new Tuple16<>(v1, v2, v3, v4, v5, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10(), tuple.v11());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 0 and 5.
+     */
+    public final Tuple2<Tuple0, Tuple5<T1, T2, T3, T4, T5>> split0() {
+        return new Tuple2<>(limit0(), skip0());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 1 and 4.
+     */
+    public final Tuple2<Tuple1<T1>, Tuple4<T2, T3, T4, T5>> split1() {
+        return new Tuple2<>(limit1(), skip1());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 2 and 3.
+     */
+    public final Tuple2<Tuple2<T1, T2>, Tuple3<T3, T4, T5>> split2() {
+        return new Tuple2<>(limit2(), skip2());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 3 and 2.
+     */
+    public final Tuple2<Tuple3<T1, T2, T3>, Tuple2<T4, T5>> split3() {
+        return new Tuple2<>(limit3(), skip3());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 4 and 1.
+     */
+    public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple1<T5>> split4() {
+        return new Tuple2<>(limit4(), skip4());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 5 and 0.
+     */
+    public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple0> split5() {
+        return new Tuple2<>(limit5(), skip5());
+    }
+
+    /**
+     * Limit this tuple to degree 0.
+     */
+    public final Tuple0 limit0() {
+        return new Tuple0();
+    }
+
+    /**
+     * Limit this tuple to degree 1.
+     */
+    public final Tuple1<T1> limit1() {
+        return new Tuple1<>(v1);
+    }
+
+    /**
+     * Limit this tuple to degree 2.
+     */
+    public final Tuple2<T1, T2> limit2() {
+        return new Tuple2<>(v1, v2);
+    }
+
+    /**
+     * Limit this tuple to degree 3.
+     */
+    public final Tuple3<T1, T2, T3> limit3() {
+        return new Tuple3<>(v1, v2, v3);
+    }
+
+    /**
+     * Limit this tuple to degree 4.
+     */
+    public final Tuple4<T1, T2, T3, T4> limit4() {
+        return new Tuple4<>(v1, v2, v3, v4);
+    }
+
+    /**
+     * Limit this tuple to degree 5.
+     */
+    public final Tuple5<T1, T2, T3, T4, T5> limit5() {
+        return this;
+    }
+
+    /**
+     * Skip 0 degrees from this tuple.
+     */
+    public final Tuple5<T1, T2, T3, T4, T5> skip0() {
+        return this;
+    }
+
+    /**
+     * Skip 1 degrees from this tuple.
+     */
+    public final Tuple4<T2, T3, T4, T5> skip1() {
+        return new Tuple4<>(v2, v3, v4, v5);
+    }
+
+    /**
+     * Skip 2 degrees from this tuple.
+     */
+    public final Tuple3<T3, T4, T5> skip2() {
+        return new Tuple3<>(v3, v4, v5);
+    }
+
+    /**
+     * Skip 3 degrees from this tuple.
+     */
+    public final Tuple2<T4, T5> skip3() {
+        return new Tuple2<>(v4, v5);
+    }
+
+    /**
+     * Skip 4 degrees from this tuple.
+     */
+    public final Tuple1<T5> skip4() {
+        return new Tuple1<>(v5);
+    }
+
+    /**
+     * Skip 5 degrees from this tuple.
+     */
+    public final Tuple0 skip5() {
+        return new Tuple0();
+    }
+
+    /**
+     * Apply this tuple as arguments to a function.
+     */
+    public final <R> R map(Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> function) {
+        return function.apply(v1, v2, v3, v4, v5);
+    }
+
+    /**
+     * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U1> Tuple5<U1, T2, T3, T4, T5> map1(Function1<? super T1, ? extends U1> function) {
+        return new Tuple5<>(function.apply(v1), v2, v3, v4, v5);
+    }
+
+    /**
+     * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U2> Tuple5<T1, U2, T3, T4, T5> map2(Function1<? super T2, ? extends U2> function) {
+        return new Tuple5<>(v1, function.apply(v2), v3, v4, v5);
+    }
+
+    /**
+     * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U3> Tuple5<T1, T2, U3, T4, T5> map3(Function1<? super T3, ? extends U3> function) {
+        return new Tuple5<>(v1, v2, function.apply(v3), v4, v5);
+    }
+
+    /**
+     * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U4> Tuple5<T1, T2, T3, U4, T5> map4(Function1<? super T4, ? extends U4> function) {
+        return new Tuple5<>(v1, v2, v3, function.apply(v4), v5);
+    }
+
+    /**
+     * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U5> Tuple5<T1, T2, T3, T4, U5> map5(Function1<? super T5, ? extends U5> function) {
+        return new Tuple5<>(v1, v2, v3, v4, function.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/3ac1abcd/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 76d12ca..1f65777 100644
--- a/src/main/groovy/groovy/lang/Tuple6.java
+++ b/src/main/groovy/groovy/lang/Tuple6.java
@@ -19,6 +19,9 @@
 
 package groovy.lang;
 
+import groovy.util.function.Function1;
+import groovy.util.function.Function6;
+
 /**
  * Represents a list of 6 typed Objects.
  *
@@ -26,70 +29,358 @@ package groovy.lang;
  */
 public class Tuple6<T1, T2, T3, T4, T5, T6> extends Tuple {
     private static final long serialVersionUID = -7848588473093102288L;
-    private final T1 first;
-    private final T2 second;
-    private final T3 third;
-    private final T4 fourth;
-    private final T5 fifth;
-    private final T6 sixth;
+    private final T1 v1;
+    private final T2 v2;
+    private final T3 v3;
+    private final T4 v4;
+    private final T5 v5;
+    private final T6 v6;
 
-    public Tuple6(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth) {
-        super(first, second, third, fourth, fifth, sixth);
+    public Tuple6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) {
+        super(v1, v2, v3, v4, v5, v6);
 
-        this.first = first;
-        this.second = second;
-        this.third = third;
-        this.fourth = fourth;
-        this.fifth = fifth;
-        this.sixth = sixth;
+        this.v1 = v1;
+        this.v2 = v2;
+        this.v3 = v3;
+        this.v4 = v4;
+        this.v5 = v5;
+        this.v6 = v6;
     }
 
-    @Override
-    public Object get(int index) {
-        switch (index) {
-            case 0:
-                return first;
-            case 1:
-                return second;
-            case 2:
-                return third;
-            case 3:
-                return fourth;
-            case 4:
-                return fifth;
-            case 5:
-                return sixth;
-            default:
-                throw new IndexOutOfBoundsException("index: " + index);
-        }
-    }
-
-    @Override
-    public int size() {
-        return 6;
+    public Tuple6(Tuple6<T1, T2, T3, T4, T5, T6> tuple) {
+        this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5, tuple.v6);
     }
 
+    @Deprecated
     public T1 getFirst() {
-        return first;
+        return v1;
     }
 
+    @Deprecated
     public T2 getSecond() {
-        return second;
+        return v2;
     }
 
+    @Deprecated
     public T3 getThird() {
-        return third;
+        return v3;
     }
 
+    @Deprecated
     public T4 getFourth() {
-        return fourth;
+        return v4;
     }
 
+    @Deprecated
     public T5 getFifth() {
-        return fifth;
+        return v5;
     }
 
+    @Deprecated
     public T6 getSixth() {
-        return sixth;
+        return v6;
+    }
+
+    public T1 v1() {
+        return v1;
+    }
+
+    public T2 v2() {
+        return v2;
+    }
+
+    public T3 v3() {
+        return v3;
+    }
+
+    public T4 v4() {
+        return v4;
+    }
+
+    public T5 v5() {
+        return v5;
+    }
+
+    public T6 v6() {
+        return v6;
+    }
+
+
+    /**
+     * Concatenate a value to this tuple.
+     */
+    public final <T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(T7 value) {
+        return new Tuple7<>(v1, v2, v3, v4, v5, v6, value);
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7> Tuple7<T1, T2, T3, T4, T5, T6, T7> concat(Tuple1<T7> tuple) {
+        return new Tuple7<>(v1, v2, v3, v4, v5, v6, tuple.v1());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple2<T7, T8> tuple) {
+        return new Tuple8<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple3<T7, T8, T9> tuple) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2(), tuple.v3());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple4<T7, T8, T9, T10> tuple) {
+        return new Tuple10<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple5<T7, T8, T9, T10, T11> tuple) {
+        return new Tuple11<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple6<T7, T8, T9, T10, T11, T12> tuple) {
+        return new Tuple12<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8, T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple7<T7, T8, T9, T10, T11, T12, T13> tuple) {
+        return new Tuple13<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8, T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple8<T7, T8, T9, T10, T11, T12, T13, T14> tuple) {
+        return new Tuple14<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8, T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple9<T7, T8, T9, T10, T11, T12, T13, T14, T15> tuple) {
+        return new Tuple15<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple10<T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> tuple) {
+        return new Tuple16<>(v1, v2, v3, v4, v5, v6, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9(), tuple.v10());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 0 and 6.
+     */
+    public final Tuple2<Tuple0, Tuple6<T1, T2, T3, T4, T5, T6>> split0() {
+        return new Tuple2<>(limit0(), skip0());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 1 and 5.
+     */
+    public final Tuple2<Tuple1<T1>, Tuple5<T2, T3, T4, T5, T6>> split1() {
+        return new Tuple2<>(limit1(), skip1());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 2 and 4.
+     */
+    public final Tuple2<Tuple2<T1, T2>, Tuple4<T3, T4, T5, T6>> split2() {
+        return new Tuple2<>(limit2(), skip2());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 3 and 3.
+     */
+    public final Tuple2<Tuple3<T1, T2, T3>, Tuple3<T4, T5, T6>> split3() {
+        return new Tuple2<>(limit3(), skip3());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 4 and 2.
+     */
+    public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple2<T5, T6>> split4() {
+        return new Tuple2<>(limit4(), skip4());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 5 and 1.
+     */
+    public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple1<T6>> split5() {
+        return new Tuple2<>(limit5(), skip5());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 6 and 0.
+     */
+    public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple0> split6() {
+        return new Tuple2<>(limit6(), skip6());
+    }
+
+    /**
+     * Limit this tuple to degree 0.
+     */
+    public final Tuple0 limit0() {
+        return new Tuple0();
+    }
+
+    /**
+     * Limit this tuple to degree 1.
+     */
+    public final Tuple1<T1> limit1() {
+        return new Tuple1<>(v1);
+    }
+
+    /**
+     * Limit this tuple to degree 2.
+     */
+    public final Tuple2<T1, T2> limit2() {
+        return new Tuple2<>(v1, v2);
+    }
+
+    /**
+     * Limit this tuple to degree 3.
+     */
+    public final Tuple3<T1, T2, T3> limit3() {
+        return new Tuple3<>(v1, v2, v3);
+    }
+
+    /**
+     * Limit this tuple to degree 4.
+     */
+    public final Tuple4<T1, T2, T3, T4> limit4() {
+        return new Tuple4<>(v1, v2, v3, v4);
+    }
+
+    /**
+     * Limit this tuple to degree 5.
+     */
+    public final Tuple5<T1, T2, T3, T4, T5> limit5() {
+        return new Tuple5<>(v1, v2, v3, v4, v5);
+    }
+
+    /**
+     * Limit this tuple to degree 6.
+     */
+    public final Tuple6<T1, T2, T3, T4, T5, T6> limit6() {
+        return this;
+    }
+
+    /**
+     * Skip 0 degrees from this tuple.
+     */
+    public final Tuple6<T1, T2, T3, T4, T5, T6> skip0() {
+        return this;
+    }
+
+    /**
+     * Skip 1 degrees from this tuple.
+     */
+    public final Tuple5<T2, T3, T4, T5, T6> skip1() {
+        return new Tuple5<>(v2, v3, v4, v5, v6);
+    }
+
+    /**
+     * Skip 2 degrees from this tuple.
+     */
+    public final Tuple4<T3, T4, T5, T6> skip2() {
+        return new Tuple4<>(v3, v4, v5, v6);
+    }
+
+    /**
+     * Skip 3 degrees from this tuple.
+     */
+    public final Tuple3<T4, T5, T6> skip3() {
+        return new Tuple3<>(v4, v5, v6);
+    }
+
+    /**
+     * Skip 4 degrees from this tuple.
+     */
+    public final Tuple2<T5, T6> skip4() {
+        return new Tuple2<>(v5, v6);
+    }
+
+    /**
+     * Skip 5 degrees from this tuple.
+     */
+    public final Tuple1<T6> skip5() {
+        return new Tuple1<>(v6);
+    }
+
+    /**
+     * Skip 6 degrees from this tuple.
+     */
+    public final Tuple0 skip6() {
+        return new Tuple0();
+    }
+
+    /**
+     * Apply this tuple as arguments to a function.
+     */
+    public final <R> R map(Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> function) {
+        return function.apply(v1, v2, v3, v4, v5, v6);
+    }
+
+    /**
+     * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U1> Tuple6<U1, T2, T3, T4, T5, T6> map1(Function1<? super T1, ? extends U1> function) {
+        return new Tuple6<>(function.apply(v1), v2, v3, v4, v5, v6);
+    }
+
+    /**
+     * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U2> Tuple6<T1, U2, T3, T4, T5, T6> map2(Function1<? super T2, ? extends U2> function) {
+        return new Tuple6<>(v1, function.apply(v2), v3, v4, v5, v6);
+    }
+
+    /**
+     * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U3> Tuple6<T1, T2, U3, T4, T5, T6> map3(Function1<? super T3, ? extends U3> function) {
+        return new Tuple6<>(v1, v2, function.apply(v3), v4, v5, v6);
+    }
+
+    /**
+     * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U4> Tuple6<T1, T2, T3, U4, T5, T6> map4(Function1<? super T4, ? extends U4> function) {
+        return new Tuple6<>(v1, v2, v3, function.apply(v4), v5, v6);
+    }
+
+    /**
+     * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U5> Tuple6<T1, T2, T3, T4, U5, T6> map5(Function1<? super T5, ? extends U5> function) {
+        return new Tuple6<>(v1, v2, v3, v4, function.apply(v5), v6);
+    }
+
+    /**
+     * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U6> Tuple6<T1, T2, T3, T4, T5, U6> map6(Function1<? super T6, ? extends U6> function) {
+        return new Tuple6<>(v1, v2, v3, v4, v5, function.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/3ac1abcd/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 05046e7..c92f45f 100644
--- a/src/main/groovy/groovy/lang/Tuple7.java
+++ b/src/main/groovy/groovy/lang/Tuple7.java
@@ -19,6 +19,9 @@
 
 package groovy.lang;
 
+import groovy.util.function.Function1;
+import groovy.util.function.Function7;
+
 /**
  * Represents a list of 7 typed Objects.
  *
@@ -26,78 +29,390 @@ package groovy.lang;
  */
 public class Tuple7<T1, T2, T3, T4, T5, T6, T7> extends Tuple {
     private static final long serialVersionUID = 4226144828786865766L;
-    private final T1 first;
-    private final T2 second;
-    private final T3 third;
-    private final T4 fourth;
-    private final T5 fifth;
-    private final T6 sixth;
-    private final T7 seventh;
-
-    public Tuple7(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh) {
-        super(first, second, third, fourth, fifth, sixth, seventh);
-
-        this.first = first;
-        this.second = second;
-        this.third = third;
-        this.fourth = fourth;
-        this.fifth = fifth;
-        this.sixth = sixth;
-        this.seventh = seventh;
-    }
+    private final T1 v1;
+    private final T2 v2;
+    private final T3 v3;
+    private final T4 v4;
+    private final T5 v5;
+    private final T6 v6;
+    private final T7 v7;
 
-    @Override
-    public Object get(int index) {
-        switch (index) {
-            case 0:
-                return first;
-            case 1:
-                return second;
-            case 2:
-                return third;
-            case 3:
-                return fourth;
-            case 4:
-                return fifth;
-            case 5:
-                return sixth;
-            case 6:
-                return seventh;
-            default:
-                throw new IndexOutOfBoundsException("index: " + index);
-        }
+    public Tuple7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) {
+        super(v1, v2, v3, v4, v5, v6, v7);
+
+        this.v1 = v1;
+        this.v2 = v2;
+        this.v3 = v3;
+        this.v4 = v4;
+        this.v5 = v5;
+        this.v6 = v6;
+        this.v7 = v7;
     }
 
-    @Override
-    public int size() {
-        return 7;
+    public Tuple7(Tuple7<T1, T2, T3, T4, T5, T6, T7> tuple) {
+        this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5, tuple.v6, tuple.v7);
     }
 
+    @Deprecated
     public T1 getFirst() {
-        return first;
+        return v1;
     }
 
+    @Deprecated
     public T2 getSecond() {
-        return second;
+        return v2;
     }
 
+    @Deprecated
     public T3 getThird() {
-        return third;
+        return v3;
     }
 
+    @Deprecated
     public T4 getFourth() {
-        return fourth;
+        return v4;
     }
 
+    @Deprecated
     public T5 getFifth() {
-        return fifth;
+        return v5;
     }
 
+    @Deprecated
     public T6 getSixth() {
-        return sixth;
+        return v6;
     }
 
+    @Deprecated
     public T7 getSeventh() {
-        return seventh;
+        return v7;
+    }
+
+    public T1 v1() {
+        return v1;
+    }
+
+    public T2 v2() {
+        return v2;
+    }
+
+    public T3 v3() {
+        return v3;
+    }
+
+    public T4 v4() {
+        return v4;
+    }
+
+    public T5 v5() {
+        return v5;
+    }
+
+    public T6 v6() {
+        return v6;
+    }
+
+    public T7 v7() {
+        return v7;
+    }
+
+
+    /**
+     * Concatenate a value to this tuple.
+     */
+    public final <T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(T8 value) {
+        return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, value);
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8> Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> concat(Tuple1<T8> tuple) {
+        return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8, T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple2<T8, T9> tuple) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1(), tuple.v2());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8, T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple3<T8, T9, T10> tuple) {
+        return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1(), tuple.v2(), tuple.v3());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8, T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple4<T8, T9, T10, T11> tuple) {
+        return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8, T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple5<T8, T9, T10, T11, T12> tuple) {
+        return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8, T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple6<T8, T9, T10, T11, T12, T13> tuple) {
+        return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8, T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple7<T8, T9, T10, T11, T12, T13, T14> tuple) {
+        return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8, T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple8<T8, T9, T10, T11, T12, T13, T14, T15> tuple) {
+        return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T8, T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple9<T8, T9, T10, T11, T12, T13, T14, T15, T16> tuple) {
+        return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8(), tuple.v9());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 0 and 7.
+     */
+    public final Tuple2<Tuple0, Tuple7<T1, T2, T3, T4, T5, T6, T7>> split0() {
+        return new Tuple2<>(limit0(), skip0());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 1 and 6.
+     */
+    public final Tuple2<Tuple1<T1>, Tuple6<T2, T3, T4, T5, T6, T7>> split1() {
+        return new Tuple2<>(limit1(), skip1());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 2 and 5.
+     */
+    public final Tuple2<Tuple2<T1, T2>, Tuple5<T3, T4, T5, T6, T7>> split2() {
+        return new Tuple2<>(limit2(), skip2());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 3 and 4.
+     */
+    public final Tuple2<Tuple3<T1, T2, T3>, Tuple4<T4, T5, T6, T7>> split3() {
+        return new Tuple2<>(limit3(), skip3());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 4 and 3.
+     */
+    public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple3<T5, T6, T7>> split4() {
+        return new Tuple2<>(limit4(), skip4());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 5 and 2.
+     */
+    public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple2<T6, T7>> split5() {
+        return new Tuple2<>(limit5(), skip5());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 6 and 1.
+     */
+    public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple1<T7>> split6() {
+        return new Tuple2<>(limit6(), skip6());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 7 and 0.
+     */
+    public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple0> split7() {
+        return new Tuple2<>(limit7(), skip7());
+    }
+
+    /**
+     * Limit this tuple to degree 0.
+     */
+    public final Tuple0 limit0() {
+        return new Tuple0();
+    }
+
+    /**
+     * Limit this tuple to degree 1.
+     */
+    public final Tuple1<T1> limit1() {
+        return new Tuple1<>(v1);
+    }
+
+    /**
+     * Limit this tuple to degree 2.
+     */
+    public final Tuple2<T1, T2> limit2() {
+        return new Tuple2<>(v1, v2);
+    }
+
+    /**
+     * Limit this tuple to degree 3.
+     */
+    public final Tuple3<T1, T2, T3> limit3() {
+        return new Tuple3<>(v1, v2, v3);
+    }
+
+    /**
+     * Limit this tuple to degree 4.
+     */
+    public final Tuple4<T1, T2, T3, T4> limit4() {
+        return new Tuple4<>(v1, v2, v3, v4);
+    }
+
+    /**
+     * Limit this tuple to degree 5.
+     */
+    public final Tuple5<T1, T2, T3, T4, T5> limit5() {
+        return new Tuple5<>(v1, v2, v3, v4, v5);
+    }
+
+    /**
+     * Limit this tuple to degree 6.
+     */
+    public final Tuple6<T1, T2, T3, T4, T5, T6> limit6() {
+        return new Tuple6<>(v1, v2, v3, v4, v5, v6);
+    }
+
+    /**
+     * Limit this tuple to degree 7.
+     */
+    public final Tuple7<T1, T2, T3, T4, T5, T6, T7> limit7() {
+        return this;
+    }
+
+    /**
+     * Skip 0 degrees from this tuple.
+     */
+    public final Tuple7<T1, T2, T3, T4, T5, T6, T7> skip0() {
+        return this;
+    }
+
+    /**
+     * Skip 1 degrees from this tuple.
+     */
+    public final Tuple6<T2, T3, T4, T5, T6, T7> skip1() {
+        return new Tuple6<>(v2, v3, v4, v5, v6, v7);
+    }
+
+    /**
+     * Skip 2 degrees from this tuple.
+     */
+    public final Tuple5<T3, T4, T5, T6, T7> skip2() {
+        return new Tuple5<>(v3, v4, v5, v6, v7);
+    }
+
+    /**
+     * Skip 3 degrees from this tuple.
+     */
+    public final Tuple4<T4, T5, T6, T7> skip3() {
+        return new Tuple4<>(v4, v5, v6, v7);
+    }
+
+    /**
+     * Skip 4 degrees from this tuple.
+     */
+    public final Tuple3<T5, T6, T7> skip4() {
+        return new Tuple3<>(v5, v6, v7);
+    }
+
+    /**
+     * Skip 5 degrees from this tuple.
+     */
+    public final Tuple2<T6, T7> skip5() {
+        return new Tuple2<>(v6, v7);
+    }
+
+    /**
+     * Skip 6 degrees from this tuple.
+     */
+    public final Tuple1<T7> skip6() {
+        return new Tuple1<>(v7);
+    }
+
+    /**
+     * Skip 7 degrees from this tuple.
+     */
+    public final Tuple0 skip7() {
+        return new Tuple0();
+    }
+
+    /**
+     * Apply this tuple as arguments to a function.
+     */
+    public final <R> R map(Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> function) {
+        return function.apply(v1, v2, v3, v4, v5, v6, v7);
+    }
+
+    /**
+     * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U1> Tuple7<U1, T2, T3, T4, T5, T6, T7> map1(Function1<? super T1, ? extends U1> function) {
+        return new Tuple7<>(function.apply(v1), v2, v3, v4, v5, v6, v7);
+    }
+
+    /**
+     * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U2> Tuple7<T1, U2, T3, T4, T5, T6, T7> map2(Function1<? super T2, ? extends U2> function) {
+        return new Tuple7<>(v1, function.apply(v2), v3, v4, v5, v6, v7);
+    }
+
+    /**
+     * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U3> Tuple7<T1, T2, U3, T4, T5, T6, T7> map3(Function1<? super T3, ? extends U3> function) {
+        return new Tuple7<>(v1, v2, function.apply(v3), v4, v5, v6, v7);
+    }
+
+    /**
+     * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U4> Tuple7<T1, T2, T3, U4, T5, T6, T7> map4(Function1<? super T4, ? extends U4> function) {
+        return new Tuple7<>(v1, v2, v3, function.apply(v4), v5, v6, v7);
+    }
+
+    /**
+     * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U5> Tuple7<T1, T2, T3, T4, U5, T6, T7> map5(Function1<? super T5, ? extends U5> function) {
+        return new Tuple7<>(v1, v2, v3, v4, function.apply(v5), v6, v7);
+    }
+
+    /**
+     * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U6> Tuple7<T1, T2, T3, T4, T5, U6, T7> map6(Function1<? super T6, ? extends U6> function) {
+        return new Tuple7<>(v1, v2, v3, v4, v5, function.apply(v6), v7);
+    }
+
+    /**
+     * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U7> Tuple7<T1, T2, T3, T4, T5, T6, U7> map7(Function1<? super T7, ? extends U7> function) {
+        return new Tuple7<>(v1, v2, v3, v4, v5, v6, function.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/3ac1abcd/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 1f38ca9..09d7cc8 100644
--- a/src/main/groovy/groovy/lang/Tuple8.java
+++ b/src/main/groovy/groovy/lang/Tuple8.java
@@ -19,6 +19,9 @@
 
 package groovy.lang;
 
+import groovy.util.function.Function1;
+import groovy.util.function.Function8;
+
 /**
  * Represents a list of 8 typed Objects.
  *
@@ -26,86 +29,422 @@ package groovy.lang;
  */
 public class Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> extends Tuple {
     private static final long serialVersionUID = -8895822084644138566L;
-    private final T1 first;
-    private final T2 second;
-    private final T3 third;
-    private final T4 fourth;
-    private final T5 fifth;
-    private final T6 sixth;
-    private final T7 seventh;
-    private final T8 eighth;
-
-    public Tuple8(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh, T8 eighth) {
-        super(first, second, third, fourth, fifth, sixth, seventh, eighth);
-
-        this.first = first;
-        this.second = second;
-        this.third = third;
-        this.fourth = fourth;
-        this.fifth = fifth;
-        this.sixth = sixth;
-        this.seventh = seventh;
-        this.eighth = eighth;
-    }
+    private final T1 v1;
+    private final T2 v2;
+    private final T3 v3;
+    private final T4 v4;
+    private final T5 v5;
+    private final T6 v6;
+    private final T7 v7;
+    private final T8 v8;
 
-    @Override
-    public Object get(int index) {
-        switch (index) {
-            case 0:
-                return first;
-            case 1:
-                return second;
-            case 2:
-                return third;
-            case 3:
-                return fourth;
-            case 4:
-                return fifth;
-            case 5:
-                return sixth;
-            case 6:
-                return seventh;
-            case 7:
-                return eighth;
-            default:
-                throw new IndexOutOfBoundsException("index: " + index);
-        }
+    public Tuple8(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) {
+        super(v1, v2, v3, v4, v5, v6, v7, v8);
+
+        this.v1 = v1;
+        this.v2 = v2;
+        this.v3 = v3;
+        this.v4 = v4;
+        this.v5 = v5;
+        this.v6 = v6;
+        this.v7 = v7;
+        this.v8 = v8;
     }
 
-    @Override
-    public int size() {
-        return 8;
+    public Tuple8(Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> tuple) {
+        this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5, tuple.v6, tuple.v7, tuple.v8);
     }
 
+    @Deprecated
     public T1 getFirst() {
-        return first;
+        return v1;
     }
 
+    @Deprecated
     public T2 getSecond() {
-        return second;
+        return v2;
     }
 
+    @Deprecated
     public T3 getThird() {
-        return third;
+        return v3;
     }
 
+    @Deprecated
     public T4 getFourth() {
-        return fourth;
+        return v4;
     }
 
+    @Deprecated
     public T5 getFifth() {
-        return fifth;
+        return v5;
     }
 
+    @Deprecated
     public T6 getSixth() {
-        return sixth;
+        return v6;
     }
 
+    @Deprecated
     public T7 getSeventh() {
-        return seventh;
+        return v7;
     }
 
+    @Deprecated
     public T8 getEighth() {
-        return eighth;
+        return v8;
+    }
+
+    public T1 v1() {
+        return v1;
+    }
+
+    public T2 v2() {
+        return v2;
+    }
+
+    public T3 v3() {
+        return v3;
+    }
+
+    public T4 v4() {
+        return v4;
+    }
+
+    public T5 v5() {
+        return v5;
+    }
+
+    public T6 v6() {
+        return v6;
+    }
+
+    public T7 v7() {
+        return v7;
+    }
+
+    public T8 v8() {
+        return v8;
+    }
+
+
+    /**
+     * Concatenate a value to this tuple.
+     */
+    public final <T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(T9 value) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, v8, value);
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> concat(Tuple1<T9> tuple) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, v8, tuple.v1());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T9, T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple2<T9, T10> tuple) {
+        return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, tuple.v1(), tuple.v2());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T9, T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple3<T9, T10, T11> tuple) {
+        return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, tuple.v1(), tuple.v2(), tuple.v3());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T9, T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple4<T9, T10, T11, T12> tuple) {
+        return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T9, T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple5<T9, T10, T11, T12, T13> tuple) {
+        return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T9, T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple6<T9, T10, T11, T12, T13, T14> tuple) {
+        return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T9, T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple7<T9, T10, T11, T12, T13, T14, T15> tuple) {
+        return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T9, T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple8<T9, T10, T11, T12, T13, T14, T15, T16> tuple) {
+        return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7(), tuple.v8());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 0 and 8.
+     */
+    public final Tuple2<Tuple0, Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>> split0() {
+        return new Tuple2<>(limit0(), skip0());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 1 and 7.
+     */
+    public final Tuple2<Tuple1<T1>, Tuple7<T2, T3, T4, T5, T6, T7, T8>> split1() {
+        return new Tuple2<>(limit1(), skip1());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 2 and 6.
+     */
+    public final Tuple2<Tuple2<T1, T2>, Tuple6<T3, T4, T5, T6, T7, T8>> split2() {
+        return new Tuple2<>(limit2(), skip2());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 3 and 5.
+     */
+    public final Tuple2<Tuple3<T1, T2, T3>, Tuple5<T4, T5, T6, T7, T8>> split3() {
+        return new Tuple2<>(limit3(), skip3());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 4 and 4.
+     */
+    public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple4<T5, T6, T7, T8>> split4() {
+        return new Tuple2<>(limit4(), skip4());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 5 and 3.
+     */
+    public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple3<T6, T7, T8>> split5() {
+        return new Tuple2<>(limit5(), skip5());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 6 and 2.
+     */
+    public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple2<T7, T8>> split6() {
+        return new Tuple2<>(limit6(), skip6());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 7 and 1.
+     */
+    public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple1<T8>> split7() {
+        return new Tuple2<>(limit7(), skip7());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 8 and 0.
+     */
+    public final Tuple2<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, Tuple0> split8() {
+        return new Tuple2<>(limit8(), skip8());
+    }
+
+    /**
+     * Limit this tuple to degree 0.
+     */
+    public final Tuple0 limit0() {
+        return new Tuple0();
+    }
+
+    /**
+     * Limit this tuple to degree 1.
+     */
+    public final Tuple1<T1> limit1() {
+        return new Tuple1<>(v1);
+    }
+
+    /**
+     * Limit this tuple to degree 2.
+     */
+    public final Tuple2<T1, T2> limit2() {
+        return new Tuple2<>(v1, v2);
+    }
+
+    /**
+     * Limit this tuple to degree 3.
+     */
+    public final Tuple3<T1, T2, T3> limit3() {
+        return new Tuple3<>(v1, v2, v3);
+    }
+
+    /**
+     * Limit this tuple to degree 4.
+     */
+    public final Tuple4<T1, T2, T3, T4> limit4() {
+        return new Tuple4<>(v1, v2, v3, v4);
+    }
+
+    /**
+     * Limit this tuple to degree 5.
+     */
+    public final Tuple5<T1, T2, T3, T4, T5> limit5() {
+        return new Tuple5<>(v1, v2, v3, v4, v5);
+    }
+
+    /**
+     * Limit this tuple to degree 6.
+     */
+    public final Tuple6<T1, T2, T3, T4, T5, T6> limit6() {
+        return new Tuple6<>(v1, v2, v3, v4, v5, v6);
+    }
+
+    /**
+     * Limit this tuple to degree 7.
+     */
+    public final Tuple7<T1, T2, T3, T4, T5, T6, T7> limit7() {
+        return new Tuple7<>(v1, v2, v3, v4, v5, v6, v7);
+    }
+
+    /**
+     * Limit this tuple to degree 8.
+     */
+    public final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> limit8() {
+        return this;
+    }
+
+    /**
+     * Skip 0 degrees from this tuple.
+     */
+    public final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> skip0() {
+        return this;
+    }
+
+    /**
+     * Skip 1 degrees from this tuple.
+     */
+    public final Tuple7<T2, T3, T4, T5, T6, T7, T8> skip1() {
+        return new Tuple7<>(v2, v3, v4, v5, v6, v7, v8);
+    }
+
+    /**
+     * Skip 2 degrees from this tuple.
+     */
+    public final Tuple6<T3, T4, T5, T6, T7, T8> skip2() {
+        return new Tuple6<>(v3, v4, v5, v6, v7, v8);
+    }
+
+    /**
+     * Skip 3 degrees from this tuple.
+     */
+    public final Tuple5<T4, T5, T6, T7, T8> skip3() {
+        return new Tuple5<>(v4, v5, v6, v7, v8);
+    }
+
+    /**
+     * Skip 4 degrees from this tuple.
+     */
+    public final Tuple4<T5, T6, T7, T8> skip4() {
+        return new Tuple4<>(v5, v6, v7, v8);
+    }
+
+    /**
+     * Skip 5 degrees from this tuple.
+     */
+    public final Tuple3<T6, T7, T8> skip5() {
+        return new Tuple3<>(v6, v7, v8);
+    }
+
+    /**
+     * Skip 6 degrees from this tuple.
+     */
+    public final Tuple2<T7, T8> skip6() {
+        return new Tuple2<>(v7, v8);
+    }
+
+    /**
+     * Skip 7 degrees from this tuple.
+     */
+    public final Tuple1<T8> skip7() {
+        return new Tuple1<>(v8);
+    }
+
+    /**
+     * Skip 8 degrees from this tuple.
+     */
+    public final Tuple0 skip8() {
+        return new Tuple0();
+    }
+
+    /**
+     * Apply this tuple as arguments to a function.
+     */
+    public final <R> R map(Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> function) {
+        return function.apply(v1, v2, v3, v4, v5, v6, v7, v8);
+    }
+
+    /**
+     * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U1> Tuple8<U1, T2, T3, T4, T5, T6, T7, T8> map1(Function1<? super T1, ? extends U1> function) {
+        return new Tuple8<>(function.apply(v1), v2, v3, v4, v5, v6, v7, v8);
+    }
+
+    /**
+     * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U2> Tuple8<T1, U2, T3, T4, T5, T6, T7, T8> map2(Function1<? super T2, ? extends U2> function) {
+        return new Tuple8<>(v1, function.apply(v2), v3, v4, v5, v6, v7, v8);
+    }
+
+    /**
+     * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U3> Tuple8<T1, T2, U3, T4, T5, T6, T7, T8> map3(Function1<? super T3, ? extends U3> function) {
+        return new Tuple8<>(v1, v2, function.apply(v3), v4, v5, v6, v7, v8);
+    }
+
+    /**
+     * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U4> Tuple8<T1, T2, T3, U4, T5, T6, T7, T8> map4(Function1<? super T4, ? extends U4> function) {
+        return new Tuple8<>(v1, v2, v3, function.apply(v4), v5, v6, v7, v8);
+    }
+
+    /**
+     * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U5> Tuple8<T1, T2, T3, T4, U5, T6, T7, T8> map5(Function1<? super T5, ? extends U5> function) {
+        return new Tuple8<>(v1, v2, v3, v4, function.apply(v5), v6, v7, v8);
+    }
+
+    /**
+     * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U6> Tuple8<T1, T2, T3, T4, T5, U6, T7, T8> map6(Function1<? super T6, ? extends U6> function) {
+        return new Tuple8<>(v1, v2, v3, v4, v5, function.apply(v6), v7, v8);
+    }
+
+    /**
+     * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U7> Tuple8<T1, T2, T3, T4, T5, T6, U7, T8> map7(Function1<? super T7, ? extends U7> function) {
+        return new Tuple8<>(v1, v2, v3, v4, v5, v6, function.apply(v7), v8);
+    }
+
+    /**
+     * Apply attribute 8 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U8> Tuple8<T1, T2, T3, T4, T5, T6, T7, U8> map8(Function1<? super T8, ? extends U8> function) {
+        return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, function.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/3ac1abcd/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 3189c10..9879b8f 100644
--- a/src/main/groovy/groovy/lang/Tuple9.java
+++ b/src/main/groovy/groovy/lang/Tuple9.java
@@ -20,6 +20,9 @@
 
 package groovy.lang;
 
+import groovy.util.function.Function1;
+import groovy.util.function.Function9;
+
 /**
  * Represents a list of 9 typed Objects.
  *
@@ -27,94 +30,454 @@ package groovy.lang;
  */
 public class Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends Tuple {
     private static final long serialVersionUID = -5181196675351911769L;
-    private final T1 first;
-    private final T2 second;
-    private final T3 third;
-    private final T4 fourth;
-    private final T5 fifth;
-    private final T6 sixth;
-    private final T7 seventh;
-    private final T8 eighth;
-    private final T9 ninth;
-
-    public Tuple9(T1 first, T2 second, T3 third, T4 fourth, T5 fifth, T6 sixth, T7 seventh, T8 eighth, T9 ninth) {
-        super(first, second, third, fourth, fifth, sixth, seventh, eighth, ninth);
-
-        this.first = first;
-        this.second = second;
-        this.third = third;
-        this.fourth = fourth;
-        this.fifth = fifth;
-        this.sixth = sixth;
-        this.seventh = seventh;
-        this.eighth = eighth;
-        this.ninth = ninth;
-    }
+    private final T1 v1;
+    private final T2 v2;
+    private final T3 v3;
+    private final T4 v4;
+    private final T5 v5;
+    private final T6 v6;
+    private final T7 v7;
+    private final T8 v8;
+    private final T9 v9;
 
-    @Override
-    public Object get(int index) {
-        switch (index) {
-            case 0:
-                return first;
-            case 1:
-                return second;
-            case 2:
-                return third;
-            case 3:
-                return fourth;
-            case 4:
-                return fifth;
-            case 5:
-                return sixth;
-            case 6:
-                return seventh;
-            case 7:
-                return eighth;
-            case 8:
-                return ninth;
-            default:
-                throw new IndexOutOfBoundsException("index: " + index);
-        }
+    public Tuple9(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) {
+        super(v1, v2, v3, v4, v5, v6, v7, v8, v9);
+
+        this.v1 = v1;
+        this.v2 = v2;
+        this.v3 = v3;
+        this.v4 = v4;
+        this.v5 = v5;
+        this.v6 = v6;
+        this.v7 = v7;
+        this.v8 = v8;
+        this.v9 = v9;
     }
 
-    @Override
-    public int size() {
-        return 9;
+    public Tuple9(Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> tuple) {
+        this(tuple.v1, tuple.v2, tuple.v3, tuple.v4, tuple.v5, tuple.v6, tuple.v7, tuple.v8, tuple.v9);
     }
 
+    @Deprecated
     public T1 getFirst() {
-        return first;
+        return v1;
     }
 
+    @Deprecated
     public T2 getSecond() {
-        return second;
+        return v2;
     }
 
+    @Deprecated
     public T3 getThird() {
-        return third;
+        return v3;
     }
 
+    @Deprecated
     public T4 getFourth() {
-        return fourth;
+        return v4;
     }
 
+    @Deprecated
     public T5 getFifth() {
-        return fifth;
+        return v5;
     }
 
+    @Deprecated
     public T6 getSixth() {
-        return sixth;
+        return v6;
     }
 
+    @Deprecated
     public T7 getSeventh() {
-        return seventh;
+        return v7;
     }
 
+    @Deprecated
     public T8 getEighth() {
-        return eighth;
+        return v8;
     }
 
+    @Deprecated
     public T9 getNinth() {
-        return ninth;
+        return v9;
+    }
+
+    public T1 v1() {
+        return v1;
+    }
+
+    public T2 v2() {
+        return v2;
+    }
+
+    public T3 v3() {
+        return v3;
+    }
+
+    public T4 v4() {
+        return v4;
+    }
+
+    public T5 v5() {
+        return v5;
+    }
+
+    public T6 v6() {
+        return v6;
+    }
+
+    public T7 v7() {
+        return v7;
+    }
+
+    public T8 v8() {
+        return v8;
+    }
+
+    public T9 v9() {
+        return v9;
+    }
+
+
+    /**
+     * Concatenate a value to this tuple.
+     */
+    public final <T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(T10 value) {
+        return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, value);
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T10> Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> concat(Tuple1<T10> tuple) {
+        return new Tuple10<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, tuple.v1());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T10, T11> Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> concat(Tuple2<T10, T11> tuple) {
+        return new Tuple11<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, tuple.v1(), tuple.v2());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T10, T11, T12> Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> concat(Tuple3<T10, T11, T12> tuple) {
+        return new Tuple12<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, tuple.v1(), tuple.v2(), tuple.v3());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T10, T11, T12, T13> Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> concat(Tuple4<T10, T11, T12, T13> tuple) {
+        return new Tuple13<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T10, T11, T12, T13, T14> Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> concat(Tuple5<T10, T11, T12, T13, T14> tuple) {
+        return new Tuple14<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T10, T11, T12, T13, T14, T15> Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> concat(Tuple6<T10, T11, T12, T13, T14, T15> tuple) {
+        return new Tuple15<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6());
+    }
+
+    /**
+     * Concatenate a tuple to this tuple.
+     */
+    public final <T10, T11, T12, T13, T14, T15, T16> Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> concat(Tuple7<T10, T11, T12, T13, T14, T15, T16> tuple) {
+        return new Tuple16<>(v1, v2, v3, v4, v5, v6, v7, v8, v9, tuple.v1(), tuple.v2(), tuple.v3(), tuple.v4(), tuple.v5(), tuple.v6(), tuple.v7());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 0 and 9.
+     */
+    public final Tuple2<Tuple0, Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>> split0() {
+        return new Tuple2<>(limit0(), skip0());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 1 and 8.
+     */
+    public final Tuple2<Tuple1<T1>, Tuple8<T2, T3, T4, T5, T6, T7, T8, T9>> split1() {
+        return new Tuple2<>(limit1(), skip1());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 2 and 7.
+     */
+    public final Tuple2<Tuple2<T1, T2>, Tuple7<T3, T4, T5, T6, T7, T8, T9>> split2() {
+        return new Tuple2<>(limit2(), skip2());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 3 and 6.
+     */
+    public final Tuple2<Tuple3<T1, T2, T3>, Tuple6<T4, T5, T6, T7, T8, T9>> split3() {
+        return new Tuple2<>(limit3(), skip3());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 4 and 5.
+     */
+    public final Tuple2<Tuple4<T1, T2, T3, T4>, Tuple5<T5, T6, T7, T8, T9>> split4() {
+        return new Tuple2<>(limit4(), skip4());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 5 and 4.
+     */
+    public final Tuple2<Tuple5<T1, T2, T3, T4, T5>, Tuple4<T6, T7, T8, T9>> split5() {
+        return new Tuple2<>(limit5(), skip5());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 6 and 3.
+     */
+    public final Tuple2<Tuple6<T1, T2, T3, T4, T5, T6>, Tuple3<T7, T8, T9>> split6() {
+        return new Tuple2<>(limit6(), skip6());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 7 and 2.
+     */
+    public final Tuple2<Tuple7<T1, T2, T3, T4, T5, T6, T7>, Tuple2<T8, T9>> split7() {
+        return new Tuple2<>(limit7(), skip7());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 8 and 1.
+     */
+    public final Tuple2<Tuple8<T1, T2, T3, T4, T5, T6, T7, T8>, Tuple1<T9>> split8() {
+        return new Tuple2<>(limit8(), skip8());
+    }
+
+    /**
+     * Split this tuple into two tuples of degree 9 and 0.
+     */
+    public final Tuple2<Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, Tuple0> split9() {
+        return new Tuple2<>(limit9(), skip9());
+    }
+
+    /**
+     * Limit this tuple to degree 0.
+     */
+    public final Tuple0 limit0() {
+        return new Tuple0();
+    }
+
+    /**
+     * Limit this tuple to degree 1.
+     */
+    public final Tuple1<T1> limit1() {
+        return new Tuple1<>(v1);
+    }
+
+    /**
+     * Limit this tuple to degree 2.
+     */
+    public final Tuple2<T1, T2> limit2() {
+        return new Tuple2<>(v1, v2);
+    }
+
+    /**
+     * Limit this tuple to degree 3.
+     */
+    public final Tuple3<T1, T2, T3> limit3() {
+        return new Tuple3<>(v1, v2, v3);
+    }
+
+    /**
+     * Limit this tuple to degree 4.
+     */
+    public final Tuple4<T1, T2, T3, T4> limit4() {
+        return new Tuple4<>(v1, v2, v3, v4);
+    }
+
+    /**
+     * Limit this tuple to degree 5.
+     */
+    public final Tuple5<T1, T2, T3, T4, T5> limit5() {
+        return new Tuple5<>(v1, v2, v3, v4, v5);
+    }
+
+    /**
+     * Limit this tuple to degree 6.
+     */
+    public final Tuple6<T1, T2, T3, T4, T5, T6> limit6() {
+        return new Tuple6<>(v1, v2, v3, v4, v5, v6);
+    }
+
+    /**
+     * Limit this tuple to degree 7.
+     */
+    public final Tuple7<T1, T2, T3, T4, T5, T6, T7> limit7() {
+        return new Tuple7<>(v1, v2, v3, v4, v5, v6, v7);
+    }
+
+    /**
+     * Limit this tuple to degree 8.
+     */
+    public final Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> limit8() {
+        return new Tuple8<>(v1, v2, v3, v4, v5, v6, v7, v8);
+    }
+
+    /**
+     * Limit this tuple to degree 9.
+     */
+    public final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> limit9() {
+        return this;
+    }
+
+    /**
+     * Skip 0 degrees from this tuple.
+     */
+    public final Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, T9> skip0() {
+        return this;
+    }
+
+    /**
+     * Skip 1 degrees from this tuple.
+     */
+    public final Tuple8<T2, T3, T4, T5, T6, T7, T8, T9> skip1() {
+        return new Tuple8<>(v2, v3, v4, v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Skip 2 degrees from this tuple.
+     */
+    public final Tuple7<T3, T4, T5, T6, T7, T8, T9> skip2() {
+        return new Tuple7<>(v3, v4, v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Skip 3 degrees from this tuple.
+     */
+    public final Tuple6<T4, T5, T6, T7, T8, T9> skip3() {
+        return new Tuple6<>(v4, v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Skip 4 degrees from this tuple.
+     */
+    public final Tuple5<T5, T6, T7, T8, T9> skip4() {
+        return new Tuple5<>(v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Skip 5 degrees from this tuple.
+     */
+    public final Tuple4<T6, T7, T8, T9> skip5() {
+        return new Tuple4<>(v6, v7, v8, v9);
+    }
+
+    /**
+     * Skip 6 degrees from this tuple.
+     */
+    public final Tuple3<T7, T8, T9> skip6() {
+        return new Tuple3<>(v7, v8, v9);
+    }
+
+    /**
+     * Skip 7 degrees from this tuple.
+     */
+    public final Tuple2<T8, T9> skip7() {
+        return new Tuple2<>(v8, v9);
+    }
+
+    /**
+     * Skip 8 degrees from this tuple.
+     */
+    public final Tuple1<T9> skip8() {
+        return new Tuple1<>(v9);
+    }
+
+    /**
+     * Skip 9 degrees from this tuple.
+     */
+    public final Tuple0 skip9() {
+        return new Tuple0();
+    }
+
+    /**
+     * Apply this tuple as arguments to a function.
+     */
+    public final <R> R map(Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> function) {
+        return function.apply(v1, v2, v3, v4, v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Apply attribute 1 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U1> Tuple9<U1, T2, T3, T4, T5, T6, T7, T8, T9> map1(Function1<? super T1, ? extends U1> function) {
+        return new Tuple9<>(function.apply(v1), v2, v3, v4, v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Apply attribute 2 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U2> Tuple9<T1, U2, T3, T4, T5, T6, T7, T8, T9> map2(Function1<? super T2, ? extends U2> function) {
+        return new Tuple9<>(v1, function.apply(v2), v3, v4, v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Apply attribute 3 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U3> Tuple9<T1, T2, U3, T4, T5, T6, T7, T8, T9> map3(Function1<? super T3, ? extends U3> function) {
+        return new Tuple9<>(v1, v2, function.apply(v3), v4, v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Apply attribute 4 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U4> Tuple9<T1, T2, T3, U4, T5, T6, T7, T8, T9> map4(Function1<? super T4, ? extends U4> function) {
+        return new Tuple9<>(v1, v2, v3, function.apply(v4), v5, v6, v7, v8, v9);
+    }
+
+    /**
+     * Apply attribute 5 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U5> Tuple9<T1, T2, T3, T4, U5, T6, T7, T8, T9> map5(Function1<? super T5, ? extends U5> function) {
+        return new Tuple9<>(v1, v2, v3, v4, function.apply(v5), v6, v7, v8, v9);
+    }
+
+    /**
+     * Apply attribute 6 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U6> Tuple9<T1, T2, T3, T4, T5, U6, T7, T8, T9> map6(Function1<? super T6, ? extends U6> function) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, function.apply(v6), v7, v8, v9);
+    }
+
+    /**
+     * Apply attribute 7 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U7> Tuple9<T1, T2, T3, T4, T5, T6, U7, T8, T9> map7(Function1<? super T7, ? extends U7> function) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, v6, function.apply(v7), v8, v9);
+    }
+
+    /**
+     * Apply attribute 8 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U8> Tuple9<T1, T2, T3, T4, T5, T6, T7, U8, T9> map8(Function1<? super T8, ? extends U8> function) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, function.apply(v8), v9);
+    }
+
+    /**
+     * Apply attribute 9 as argument to a function and return a new tuple with the substituted argument.
+     */
+    public final <U9> Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, U9> map9(Function1<? super T9, ? extends U9> function) {
+        return new Tuple9<>(v1, v2, v3, v4, v5, v6, v7, v8, function.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/3ac1abcd/src/main/groovy/groovy/util/function/Consumer0.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/util/function/Consumer0.java b/src/main/groovy/groovy/util/function/Consumer0.java
new file mode 100644
index 0000000..b146e9f
--- /dev/null
+++ b/src/main/groovy/groovy/util/function/Consumer0.java
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+package groovy.util.function;
+
+import groovy.lang.Tuple0;
+
+
+/**
+ * A consumer with 0 arguments.
+ *
+ * @since 3.0.0
+ */
+@FunctionalInterface
+public interface Consumer0 extends Runnable {
+
+    /**
+     * Performs this operation on the given argument.
+     *
+     * @param args The arguments as a tuple.
+     */
+    default void accept(Tuple0 args) {
+        accept();
+    }
+
+    /**
+     * Performs this operation on the given argument.
+     */
+    void accept();
+
+    @Override
+    default void run() {
+        accept();
+    }
+
+    /**
+     * Convert this consumer to a {@link Runnable}.
+     */
+    default Runnable toRunnable() {
+        return this::accept;
+    }
+
+    /**
+     * Convert to this consumer from a {@link Runnable}.
+     */
+    static Consumer0 from(Runnable runnable) {
+        return runnable::run;
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/3ac1abcd/src/main/groovy/groovy/util/function/Consumer1.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/util/function/Consumer1.java b/src/main/groovy/groovy/util/function/Consumer1.java
new file mode 100644
index 0000000..c19441f
--- /dev/null
+++ b/src/main/groovy/groovy/util/function/Consumer1.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+package groovy.util.function;
+
+import groovy.lang.Tuple1;
+
+import java.util.function.Consumer;
+
+/**
+ * A consumer with 1 arguments.
+ *
+ * @since 3.0.0
+ */
+@FunctionalInterface
+public interface Consumer1<T1> extends Consumer<T1> {
+
+    /**
+     * Performs this operation on the given argument.
+     *
+     * @param args The arguments as a tuple.
+     */
+    default void accept(Tuple1<? extends T1> args) {
+        accept(args.v1());
+    }
+
+    /**
+     * Performs this operation on the given argument.
+     */
+    @Override
+    void accept(T1 v1);
+
+    /**
+     * Convert this consumer to a {@link Consumer}.
+     */
+    default Consumer<T1> toConsumer() {
+        return this::accept;
+    }
+
+    /**
+     * Convert to this consumer from a {@link Consumer}.
+     */
+    static <T1> Consumer1<T1> from(Consumer<? super T1> consumer) {
+        return consumer::accept;
+    }
+
+    /**
+     * Let this consumer partially accept the arguments.
+     */
+    default Consumer0 acceptPartially(T1 v1) {
+        return () -> accept(v1);
+    }
+
+    /**
+     * Let this consumer partially accept the arguments.
+     */
+    default Consumer0 acceptPartially(Tuple1<? extends T1> args) {
+        return () -> accept(args.v1());
+    }
+}


Mime
View raw message