@Test public void testFromEntry() { Entry<Integer,String> entry = new SimpleImmutableEntry<>(10, "IO"); Pair<Integer,String> pair0 = Pair.fromEntry(entry); assertEquals(entry.getKey(), pair0.getFirst()); assertEquals(entry.getValue(), pair0.getSecond()); Pair<Object,Object> pair = Pair.fromEntry(entry); assertEquals(entry.getKey(), pair.getFirst()); assertEquals(entry.getValue(), pair.getSecond()); Pair<Number,CharSequence> pair2 = Pair.fromEntry(entry); assertEquals(entry.getKey(), pair2.getFirst()); assertEquals(entry.getValue(), pair2.getSecond()); }
public static <K2,V2,K1 extends K2,V1 extends V2> Pair<K2,V2> fromEntry(Entry<K1,V1> entry) { return new Pair<>(entry.getKey(), entry.getValue()); }
Pair { public static <K2,V2,K1 extends K2,V1 extends V2> Pair<K2,V2> fromEntry(Entry<K1,V1> entry) { return new Pair<>(entry.getKey(), entry.getValue()); } }
Pair { public static <K2,V2,K1 extends K2,V1 extends V2> Pair<K2,V2> fromEntry(Entry<K1,V1> entry) { return new Pair<>(entry.getKey(), entry.getValue()); } Pair(A f, B s); }
Pair { public static <K2,V2,K1 extends K2,V1 extends V2> Pair<K2,V2> fromEntry(Entry<K1,V1> entry) { return new Pair<>(entry.getKey(), entry.getValue()); } 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); }
Pair { public static <K2,V2,K1 extends K2,V1 extends V2> Pair<K2,V2> fromEntry(Entry<K1,V1> entry) { return new Pair<>(entry.getKey(), entry.getValue()); } 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);  }