1 package org.davidmoten.rx.jdbc.tuple;
2
3
4
5
6
7
8
9
10 public class Tuple3<T1, T2, T3> {
11
12 private final T1 value1;
13 private final T2 value2;
14 private final T3 value3;
15
16
17
18
19
20
21
22
23 public Tuple3(T1 value1, T2 value2, T3 value3) {
24 this.value1 = value1;
25 this.value2 = value2;
26 this.value3 = value3;
27 }
28
29 public static <T1,T2,T3> Tuple3<T1,T2,T3> create(T1 value1, T2 value2, T3 value3) {
30 return new Tuple3<T1,T2,T3>(value1, value2, value3);
31 }
32
33 public T1 value1() {
34 return value1;
35 }
36
37 public T2 value2() {
38 return value2;
39 }
40
41 public T3 value3() {
42 return value3;
43 }
44
45 public T1 _1() {
46 return value1;
47 }
48
49 public T2 _2() {
50 return value2;
51 }
52
53 public T3 _3() {
54 return value3;
55 }
56
57 @Override
58 public int hashCode() {
59 final int prime = 31;
60 int result = 1;
61 result = prime * result + ((value1 == null) ? 0 : value1.hashCode());
62 result = prime * result + ((value2 == null) ? 0 : value2.hashCode());
63 result = prime * result + ((value3 == null) ? 0 : value3.hashCode());
64 return result;
65 }
66
67 @Override
68 public boolean equals(Object obj) {
69 if (this == obj)
70 return true;
71 if (obj == null)
72 return false;
73 if (getClass() != obj.getClass())
74 return false;
75 Tuple3<?, ?, ?> other = (Tuple3<?, ?, ?>) obj;
76 if (value1 == null) {
77 if (other.value1 != null)
78 return false;
79 } else if (!value1.equals(other.value1))
80 return false;
81 if (value2 == null) {
82 if (other.value2 != null)
83 return false;
84 } else if (!value2.equals(other.value2))
85 return false;
86 if (value3 == null) {
87 if (other.value3 != null)
88 return false;
89 } else if (!value3.equals(other.value3))
90 return false;
91 return true;
92 }
93
94 @Override
95 public String toString() {
96 return "Tuple3 [value1=" + value1 + ", value2=" + value2 + ", value3=" + value3 + "]";
97 }
98
99 }