Repository: groovy
Updated Branches:
  refs/heads/master 95f692dc4 -> 825b781d2


Make `Tuple0` singleton


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/825b781d
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/825b781d
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/825b781d

Branch: refs/heads/master
Commit: 825b781d2486d79814460dfa79641794def34438
Parents: 95f692d
Author: Daniel Sun <sun...@apache.org>
Authored: Sat Nov 24 21:20:38 2018 +0800
Committer: Daniel Sun <sun...@apache.org>
Committed: Sat Nov 24 21:20:55 2018 +0800

----------------------------------------------------------------------
 src/main/groovy/groovy/lang/Tuple.java   | 2 +-
 src/main/groovy/groovy/lang/Tuple0.java  | 9 +++------
 src/main/groovy/groovy/lang/Tuple1.java  | 4 ++--
 src/main/groovy/groovy/lang/Tuple10.java | 4 ++--
 src/main/groovy/groovy/lang/Tuple11.java | 4 ++--
 src/main/groovy/groovy/lang/Tuple12.java | 4 ++--
 src/main/groovy/groovy/lang/Tuple13.java | 4 ++--
 src/main/groovy/groovy/lang/Tuple14.java | 4 ++--
 src/main/groovy/groovy/lang/Tuple15.java | 4 ++--
 src/main/groovy/groovy/lang/Tuple16.java | 4 ++--
 src/main/groovy/groovy/lang/Tuple2.java  | 4 ++--
 src/main/groovy/groovy/lang/Tuple3.java  | 4 ++--
 src/main/groovy/groovy/lang/Tuple4.java  | 4 ++--
 src/main/groovy/groovy/lang/Tuple5.java  | 4 ++--
 src/main/groovy/groovy/lang/Tuple6.java  | 4 ++--
 src/main/groovy/groovy/lang/Tuple7.java  | 4 ++--
 src/main/groovy/groovy/lang/Tuple8.java  | 4 ++--
 src/main/groovy/groovy/lang/Tuple9.java  | 4 ++--
 18 files changed, 36 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/src/main/groovy/groovy/lang/Tuple.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/Tuple.java 
b/src/main/groovy/groovy/lang/Tuple.java
index 4dd25b5..bd2b34a 100644
--- a/src/main/groovy/groovy/lang/Tuple.java
+++ b/src/main/groovy/groovy/lang/Tuple.java
@@ -184,7 +184,7 @@ public class Tuple<E> extends AbstractList<E> implements 
Serializable, Cloneable
      * Construct a tuple of degree 0.
      */
     public static Tuple0 tuple() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 95c098f..10bc91a 100644
--- a/src/main/groovy/groovy/lang/Tuple0.java
+++ b/src/main/groovy/groovy/lang/Tuple0.java
@@ -27,12 +27,9 @@ import groovy.util.function.Function0;
  */
 public final class Tuple0 extends Tuple {
     private static final long serialVersionUID = -3791115121904072346L;
+    public static final Tuple0 INSTANCE = new Tuple0();
 
-    public Tuple0() {
-    }
-
-    public Tuple0(Tuple0 tuple) {
-    }
+    private Tuple0() {}
 
     /**
      * Concatenate a value to this tuple.
@@ -183,6 +180,6 @@ public final class Tuple0 extends Tuple {
 
     @Override
     public Tuple0 clone() {
-        return new Tuple0(this);
+        return INSTANCE;
     }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 e152376..c76c6d2 100644
--- a/src/main/groovy/groovy/lang/Tuple1.java
+++ b/src/main/groovy/groovy/lang/Tuple1.java
@@ -178,7 +178,7 @@ public final class Tuple1<T1> extends Tuple {
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -199,7 +199,7 @@ public final class Tuple1<T1> extends Tuple {
      * Skip 1 degrees from this tuple.
      */
     public final Tuple0 skip1() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 67ddded..6670375 100644
--- a/src/main/groovy/groovy/lang/Tuple10.java
+++ b/src/main/groovy/groovy/lang/Tuple10.java
@@ -231,7 +231,7 @@ public final class Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10> extends Tupl
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -378,7 +378,7 @@ public final class Tuple10<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10> extends Tupl
      * Skip 10 degrees from this tuple.
      */
     public final Tuple0 skip10() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 23bb963..b160e42 100644
--- a/src/main/groovy/groovy/lang/Tuple11.java
+++ b/src/main/groovy/groovy/lang/Tuple11.java
@@ -237,7 +237,7 @@ public final class Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11> extends
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -398,7 +398,7 @@ public final class Tuple11<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11> extends
      * Skip 11 degrees from this tuple.
      */
     public final Tuple0 skip11() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 582cb92..e77aedd 100644
--- a/src/main/groovy/groovy/lang/Tuple12.java
+++ b/src/main/groovy/groovy/lang/Tuple12.java
@@ -244,7 +244,7 @@ public final class Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12> ex
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -419,7 +419,7 @@ public final class Tuple12<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12> ex
      * Skip 12 degrees from this tuple.
      */
     public final Tuple0 skip12() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 d5ed275..a6dadcb 100644
--- a/src/main/groovy/groovy/lang/Tuple13.java
+++ b/src/main/groovy/groovy/lang/Tuple13.java
@@ -249,7 +249,7 @@ public final class Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12, T1
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -438,7 +438,7 @@ public final class Tuple13<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12, T1
      * Skip 13 degrees from this tuple.
      */
     public final Tuple0 skip13() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 b9988b3..91b403f 100644
--- a/src/main/groovy/groovy/lang/Tuple14.java
+++ b/src/main/groovy/groovy/lang/Tuple14.java
@@ -254,7 +254,7 @@ public final class Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12, T1
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -457,7 +457,7 @@ public final class Tuple14<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12, T1
      * Skip 14 degrees from this tuple.
      */
     public final Tuple0 skip14() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 5d6f56d..7399ec8 100644
--- a/src/main/groovy/groovy/lang/Tuple15.java
+++ b/src/main/groovy/groovy/lang/Tuple15.java
@@ -260,7 +260,7 @@ public final class Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12, T1
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -477,7 +477,7 @@ public final class Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12, T1
      * Skip 15 degrees from this tuple.
      */
     public final Tuple0 skip15() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 39a477f..22446ab 100644
--- a/src/main/groovy/groovy/lang/Tuple16.java
+++ b/src/main/groovy/groovy/lang/Tuple16.java
@@ -260,7 +260,7 @@ public final class Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12, T1
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -491,7 +491,7 @@ public final class Tuple16<T1, T2, T3, T4, T5, T6, T7, T8, 
T9, T10, T11, T12, T1
      * Skip 16 degrees from this tuple.
      */
     public final Tuple0 skip16() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 821aea9..783f2a1 100644
--- a/src/main/groovy/groovy/lang/Tuple2.java
+++ b/src/main/groovy/groovy/lang/Tuple2.java
@@ -191,7 +191,7 @@ public final class Tuple2<T1, T2> extends Tuple {
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -226,7 +226,7 @@ public final class Tuple2<T1, T2> extends Tuple {
      * Skip 2 degrees from this tuple.
      */
     public final Tuple0 skip2() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 e3945fb..370a0cc 100644
--- a/src/main/groovy/groovy/lang/Tuple3.java
+++ b/src/main/groovy/groovy/lang/Tuple3.java
@@ -202,7 +202,7 @@ public final class Tuple3<T1, T2, T3> extends Tuple {
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -251,7 +251,7 @@ public final class Tuple3<T1, T2, T3> extends Tuple {
      * Skip 3 degrees from this tuple.
      */
     public final Tuple0 skip3() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 c18d014..cc2b9e3 100644
--- a/src/main/groovy/groovy/lang/Tuple4.java
+++ b/src/main/groovy/groovy/lang/Tuple4.java
@@ -214,7 +214,7 @@ public final class Tuple4<T1, T2, T3, T4> extends Tuple {
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -277,7 +277,7 @@ public final class Tuple4<T1, T2, T3, T4> extends Tuple {
      * Skip 4 degrees from this tuple.
      */
     public final Tuple0 skip4() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 9269377..cbeaf6f 100644
--- a/src/main/groovy/groovy/lang/Tuple5.java
+++ b/src/main/groovy/groovy/lang/Tuple5.java
@@ -225,7 +225,7 @@ public final class Tuple5<T1, T2, T3, T4, T5> extends Tuple 
{
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -302,7 +302,7 @@ public final class Tuple5<T1, T2, T3, T4, T5> extends Tuple 
{
      * Skip 5 degrees from this tuple.
      */
     public final Tuple0 skip5() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 d4d79a1..055f41e 100644
--- a/src/main/groovy/groovy/lang/Tuple6.java
+++ b/src/main/groovy/groovy/lang/Tuple6.java
@@ -236,7 +236,7 @@ public final class Tuple6<T1, T2, T3, T4, T5, T6> extends 
Tuple {
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -327,7 +327,7 @@ public final class Tuple6<T1, T2, T3, T4, T5, T6> extends 
Tuple {
      * Skip 6 degrees from this tuple.
      */
     public final Tuple0 skip6() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 8debcfd..95fc259 100644
--- a/src/main/groovy/groovy/lang/Tuple7.java
+++ b/src/main/groovy/groovy/lang/Tuple7.java
@@ -247,7 +247,7 @@ public final class Tuple7<T1, T2, T3, T4, T5, T6, T7> 
extends Tuple {
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -352,7 +352,7 @@ public final class Tuple7<T1, T2, T3, T4, T5, T6, T7> 
extends Tuple {
      * Skip 7 degrees from this tuple.
      */
     public final Tuple0 skip7() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 d01321e..e672b24 100644
--- a/src/main/groovy/groovy/lang/Tuple8.java
+++ b/src/main/groovy/groovy/lang/Tuple8.java
@@ -258,7 +258,7 @@ public final class Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> 
extends Tuple {
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -377,7 +377,7 @@ public final class Tuple8<T1, T2, T3, T4, T5, T6, T7, T8> 
extends Tuple {
      * Skip 8 degrees from this tuple.
      */
     public final Tuple0 skip8() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/825b781d/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 ecc13bf..dada7b0 100644
--- a/src/main/groovy/groovy/lang/Tuple9.java
+++ b/src/main/groovy/groovy/lang/Tuple9.java
@@ -270,7 +270,7 @@ public final class Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, 
T9> extends Tuple {
      * Limit this tuple to degree 0.
      */
     public final Tuple0 limit0() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**
@@ -403,7 +403,7 @@ public final class Tuple9<T1, T2, T3, T4, T5, T6, T7, T8, 
T9> extends Tuple {
      * Skip 9 degrees from this tuple.
      */
     public final Tuple0 skip9() {
-        return new Tuple0();
+        return Tuple0.INSTANCE;
     }
 
     /**

Reply via email to