### Question:
Pair implements Comparable<Pair<T1, T2>> { @SuppressWarnings("unchecked") @Override public boolean equals(Object o) { Pair<T1, T2> other; if (o == null) { return false; } else { if (o instanceof Pair) { other = (Pair<T1, T2>) o; } else { throw new ClassCastException(Pair.class + " cannot be compared with " + o.getClass()); } return this.first.equals(other.first) && this.second.equals(other.second); } } Pair();  Pair(T1 first, T2 second); @Override int compareTo(Pair<T1, T2> other); @SuppressWarnings("unchecked") @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); public T1 first; public T2 second; }### Answer:
@Test public void testEquals() { System.out.println("equals"); Object o = null; Pair<String, String> p1 = new Pair<String, String>("a", "b"); Pair<String, String> p2 = new Pair<String, String>("a", "b"); Pair<String, String> p3 = new Pair<String, String>("a", "c"); assert (p1.equals(p2)); assert (!p1.equals(p3)); }