equal
deleted
inserted
replaced
50 return (x == null && y == null) || (x != null && x.equals(y)); |
50 return (x == null && y == null) || (x != null && x.equals(y)); |
51 } |
51 } |
52 |
52 |
53 public boolean equals(Object other) { |
53 public boolean equals(Object other) { |
54 return |
54 return |
55 other instanceof Pair && |
55 other instanceof Pair<?,?> && |
56 equals(fst, ((Pair)other).fst) && |
56 equals(fst, ((Pair<?,?>)other).fst) && |
57 equals(snd, ((Pair)other).snd); |
57 equals(snd, ((Pair<?,?>)other).snd); |
58 } |
58 } |
59 |
59 |
60 public int hashCode() { |
60 public int hashCode() { |
61 if (fst == null) return (snd == null) ? 0 : snd.hashCode() + 1; |
61 if (fst == null) return (snd == null) ? 0 : snd.hashCode() + 1; |
62 else if (snd == null) return fst.hashCode() + 2; |
62 else if (snd == null) return fst.hashCode() + 2; |