### Question:
Pair implements Serializable { public Pair(A a, B b) { this.first = a; this.second = b; } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b);  }### Answer:
@Test public void testPair() { Pair<String, Custom> p = Pair.of(CUSTOM, new Custom(1)); assertEquals(CUSTOM, p.getFirst()); assertNotEquals(ANOTHER, p.getFirst()); assertEquals(new Custom(1), p.getSecond()); assertNotEquals(new Custom(2), p.getSecond()); assertTrue(p.hasElement(CUSTOM)); assertFalse(p.hasElement(ANOTHER)); assertTrue(p.hasElement(new Custom(1))); assertFalse(p.hasElement(new Custom(2))); assertFalse(p.hasElement(null)); }