2 package org.apidesign.apifest08.currency;
5 public final class Pair<A,B> {
8 private final B second;
10 public Pair(A first, B second) {
15 public A getFirst() { return first; }
16 public B getSecond() { return second; }
19 public String toString() {
20 return "(" + first + ", " + second + ")";
23 private static boolean equals(Object x, Object y) {
24 return (x == null && y == null) || (x != null && x.equals(y));
28 public int hashCode() {
30 hash = 59 * hash + (this.first != null ? this.first.hashCode() : 0);
31 hash = 59 * hash + (this.second != null ? this.second.hashCode() : 0);
36 public boolean equals(Object obj) {
40 if (getClass() != obj.getClass()) {
43 final Pair<A, B> other = (Pair<A, B>) obj;
44 if (this.first != other.first && (this.first == null || !this.first.equals(other.first))) {
47 if (this.second != other.second && (this.second == null || !this.second.equals(other.second))) {