14
14
15
15
package org .organicdesign .fp .tuple ;
16
16
17
+ import org .jetbrains .annotations .NotNull ;
18
+
17
19
import java .io .Serializable ;
18
20
import java .util .Objects ;
19
21
24
26
// ======================================================================================
25
27
26
28
/**
27
- Holds 12 items of potentially different types. Designed to let you easily create immutable
28
- subclasses (to give your data structures meaningful names) with correct equals(), hashCode(), and
29
- toString() methods.
29
+ * Holds 12 items of potentially different types. Designed to let you easily create immutable
30
+ * subclasses (to give your data structures meaningful names) with correct equals(), hashCode(), and
31
+ * toString() methods.
30
32
*/
31
33
public class Tuple12 <A ,B ,C ,D ,E ,F ,G ,H ,I ,J ,K ,L > implements Serializable {
32
34
33
35
// For serializable. Make sure to change whenever internal data format changes.
34
- // Implemented because implementing serializable only on a sub-class of an
36
+ // Implemented because implementing serializable only on a subclass of an
35
37
// immutable class requires a serialization proxy. That's probably worse than
36
- // the conceptual burdeon of all tuples being Serializable. private static final long serialVersionUID = 20160906065500L;
38
+ // the conceptual burden of all tuples being Serializable.
39
+ private static final long serialVersionUID = 20211228180200L ;
37
40
38
- // Fields are protected so that sub-classes can make accessor methods with meaningful names.
41
+ // Fields are protected so that subclasses can make accessor methods with meaningful names.
39
42
protected final A _1 ;
40
43
protected final B _2 ;
41
44
protected final C _3 ;
@@ -50,19 +53,19 @@ public class Tuple12<A,B,C,D,E,F,G,H,I,J,K,L> implements Serializable {
50
53
protected final L _12 ;
51
54
52
55
/**
53
- Constructor is protected (not public) for easy inheritance. Josh Bloch's "Item 1" says public
54
- static factory methods are better than constructors because they have names, they can return
55
- an existing object instead of a new one, and they can return a sub-type . Therefore, you
56
- have more flexibility with a static factory as part of your public API then with a public
57
- constructor.
56
+ * Constructor is protected (not public) for easy inheritance. Josh Bloch's "Item 1" says public
57
+ * static factory methods are better than constructors because they have names, they can return
58
+ * an existing object instead of a new one, and they can return a subtype . Therefore, you
59
+ * have more flexibility with a static factory as part of your public API then with a public
60
+ * constructor.
58
61
*/
59
62
protected Tuple12 (A a , B b , C c , D d , E e , F f , G g , H h , I i , J j , K k , L l ) {
60
63
_1 = a ; _2 = b ; _3 = c ; _4 = d ; _5 = e ; _6 = f ; _7 = g ; _8 = h ; _9 = i ;
61
64
_10 = j ; _11 = k ; _12 = l ;
62
65
}
63
66
64
67
/** Public static factory method */
65
- public static <A ,B ,C ,D ,E ,F ,G ,H ,I ,J ,K ,L > Tuple12 <A ,B ,C ,D ,E ,F ,G ,H ,I ,J ,K ,L >
68
+ public static <A ,B ,C ,D ,E ,F ,G ,H ,I ,J ,K ,L > @ NotNull Tuple12 <A ,B ,C ,D ,E ,F ,G ,H ,I ,J ,K ,L >
66
69
of (A a , B b , C c , D d , E e , F f , G g , H h , I i , J j , K k , L l ) {
67
70
return new Tuple12 <>(a , b , c , d , e , f , g , h , i , j , k , l );
68
71
}
@@ -93,7 +96,7 @@ protected Tuple12(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) {
93
96
public L _12 () { return _12 ; }
94
97
95
98
@ Override
96
- public String toString () {
99
+ public @ NotNull String toString () {
97
100
return getClass ().getSimpleName () + "(" +
98
101
stringify (_1 ) + "," + stringify (_2 ) + "," +
99
102
stringify (_3 ) + "," + stringify (_4 ) + "," + stringify (_5 ) + "," +
0 commit comments