@Test public void testHashCode() { Tuple2<String, Integer> pair = Tuple2.of("a", null); assertThat(pair.hashCode()).isEqualTo(pair.hashCode()); assertThat(pair.hashCode()).isNotEqualTo("not a pair".hashCode()); }
@Override public int hashCode() { int result = item1 != null ? item1.hashCode() : 0; result = 31 * result + (item2 != null ? item2.hashCode() : 0); return result; }
Tuple2 implements Tuple { @Override public int hashCode() { int result = item1 != null ? item1.hashCode() : 0; result = 31 * result + (item2 != null ? item2.hashCode() : 0); return result; } }
Tuple2 implements Tuple { @Override public int hashCode() { int result = item1 != null ? item1.hashCode() : 0; result = 31 * result + (item2 != null ? item2.hashCode() : 0); return result; } protected  Tuple2(L left, R right); }
Tuple2 implements Tuple { @Override public int hashCode() { int result = item1 != null ? item1.hashCode() : 0; result = 31 * result + (item2 != null ? item2.hashCode() : 0); return result; } protected  Tuple2(L left, R right); static Tuple2<L, R> of(L l, R r); L getItem1(); R getItem2(); Tuple2<T, R> mapItem1(Function<L, T> mapper); Tuple2<L, T> mapItem2(Function<R, T> mapper); @Override Object nth(int index); @Override List<Object> asList(); @Override boolean equals(Object o); @Override int hashCode(); int size(); @Override String toString(); }
Tuple2 implements Tuple { @Override public int hashCode() { int result = item1 != null ? item1.hashCode() : 0; result = 31 * result + (item2 != null ? item2.hashCode() : 0); return result; } protected  Tuple2(L left, R right); static Tuple2<L, R> of(L l, R r); L getItem1(); R getItem2(); Tuple2<T, R> mapItem1(Function<L, T> mapper); Tuple2<L, T> mapItem2(Function<R, T> mapper); @Override Object nth(int index); @Override List<Object> asList(); @Override boolean equals(Object o); @Override int hashCode(); int size(); @Override String toString();  }