Created by marc on 3/25/14.
| 4 | * Created by marc on 3/25/14. |
| 5 | */ |
| 6 | public class Triple<A, B, C> extends Pair<A,B> { |
| 7 | final public C third; |
| 8 | |
| 9 | public Triple(A first, B second, C third) { |
| 10 | super(first, second); |
| 11 | this.third = third; |
| 12 | } |
| 13 | |
| 14 | @Override |
| 15 | public boolean equals(Object o) { |
| 16 | if (this == o) return true; |
| 17 | if (!(o instanceof Triple)) return false; |
| 18 | if (!super.equals(o)) return false; |
| 19 | |
| 20 | Triple triple = (Triple) o; |
| 21 | |
| 22 | return !(third != null ? !third.equals(triple.third) : triple.third != null); |
| 23 | |
| 24 | } |
| 25 | |
| 26 | @Override |
| 27 | public int hashCode() { |
| 28 | int result = super.hashCode(); |
| 29 | result = 31 * result + (third != null ? third.hashCode() : 0); |
| 30 | return result; |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public String toString() { |
| 35 | return "Triple{" + first + "," + second + ","+third+"}"; |
| 36 | } |
| 37 | |
| 38 | @Override |
| 39 | public Triple<A, B, C> duplicate() { |
| 40 | return new Triple<>(first instanceof Mutable ? (A) ((Mutable)first).duplicate() : first, second instanceof Mutable ? (B) ((Mutable)second).duplicate() : second, third instanceof Mutable ? (C) ((Mutable)third).duplicate() : third); |
| 41 | } |
| 42 | } |
no outgoing calls
no test coverage detected