View Javadoc
1   package com.github.davidmoten.rx.jdbc.tuple;
2   
3   /**
4    * An explicitly typed tuple.
5    * 
6    * @param <T1>
7    * @param <T2>
8    * @param <T3>
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       * Constructor.
18       * 
19       * @param value1
20       * @param value2
21       * @param value3
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 T1 value1() {
30          return value1;
31      }
32  
33      public T2 value2() {
34          return value2;
35      }
36  
37      public T3 value3() {
38          return value3;
39      }
40  
41      @Override
42      public int hashCode() {
43          final int prime = 31;
44          int result = 1;
45          result = prime * result + ((value1 == null) ? 0 : value1.hashCode());
46          result = prime * result + ((value2 == null) ? 0 : value2.hashCode());
47          result = prime * result + ((value3 == null) ? 0 : value3.hashCode());
48          return result;
49      }
50  
51      @Override
52      public boolean equals(Object obj) {
53          if (this == obj)
54              return true;
55          if (obj == null)
56              return false;
57          if (getClass() != obj.getClass())
58              return false;
59          Tuple3<?, ?, ?> other = (Tuple3<?, ?, ?>) obj;
60          if (value1 == null) {
61              if (other.value1 != null)
62                  return false;
63          } else if (!value1.equals(other.value1))
64              return false;
65          if (value2 == null) {
66              if (other.value2 != null)
67                  return false;
68          } else if (!value2.equals(other.value2))
69              return false;
70          if (value3 == null) {
71              if (other.value3 != null)
72                  return false;
73          } else if (!value3.equals(other.value3))
74              return false;
75          return true;
76      }
77  
78      @Override
79      public String toString() {
80          return "Tuple3 [value1=" + value1 + ", value2=" + value2 + ", value3=" + value3 + "]";
81      }
82  
83  }