### Question:
Pair { public Pair<B,A> swap() { return new Pair<>(getSecond(), getFirst()); } Pair(A f, B s); @Override int hashCode(); @Override boolean equals(Object o); A getFirst(); B getSecond(); @Override String toString(); String toString(String prefix, String separator, String suffix); Entry<A,B> toMapEntry(); Pair<B,A> swap(); static Pair<K2,V2> fromEntry(Entry<K1,V1> entry);  }### Answer:
@Test public void testSwap() { Pair<Integer,String> pair = new Pair<>(25, "twenty-five"); assertEquals(pair, pair.swap().swap()); Pair<String,Integer> pair2 = new Pair<>("twenty-five", 25); assertEquals(pair, pair2.swap()); assertEquals(pair2, pair.swap()); }