Pair { @Override public int hashCode() { int result = lhs != null ? lhs.hashCode() : 0; result = 31 * result + (rhs != null ? rhs.hashCode() : 0); return result; } Pair(T1 lhs, T2 rhs); static Pair<T1, T2> of(T1 lhs, T2 rhs); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Function<Pair<T1, T2>, T1> lhsFn(); static Function<Pair<T1, T2>, T2> rhsFn(); static Comparator<Pair<T1, ?>> lhsComparator(final Comparator<T1> comparator); final T1 lhs; final T2 rhs; }
@Test public void testHashCode() { Pair pair = new Pair("lhs", "rhs"); Assert.assertEquals(3433830, pair.hashCode()); }