@Test public void testMapItem2() { Tuple2<String, Integer> pair = Tuple2.of("Hello", 42); Tuple2<String, String> newPair = pair.mapItem2(i -> Integer.toString(i)); assertThat(newPair).containsExactly("Hello", "42"); newPair = pair.mapItem2(i -> null); assertThat(newPair).containsExactly("Hello", null); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> pair.mapItem2(s -> { throw new IllegalArgumentException("boom"); })).withMessage("boom"); }
public <T> Tuple2<L, T> mapItem2(Function<R, T> mapper) { return Tuple2.of(item1, mapper.apply(item2)); }
Tuple2 implements Tuple { public <T> Tuple2<L, T> mapItem2(Function<R, T> mapper) { return Tuple2.of(item1, mapper.apply(item2)); } }
Tuple2 implements Tuple { public <T> Tuple2<L, T> mapItem2(Function<R, T> mapper) { return Tuple2.of(item1, mapper.apply(item2)); } protected  Tuple2(L left, R right); }
Tuple2 implements Tuple { public <T> Tuple2<L, T> mapItem2(Function<R, T> mapper) { return Tuple2.of(item1, mapper.apply(item2)); } 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 { public <T> Tuple2<L, T> mapItem2(Function<R, T> mapper) { return Tuple2.of(item1, mapper.apply(item2)); } 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();  }