@Test public void testNth() { assertThat(someTuple.nth(0)).isEqualTo(1); assertThat(someTuple.nth(1)).isEqualTo(2); assertThat(someTuple.nth(2)).isEqualTo(3); assertThat(someTuple.nth(3)).isEqualTo(4); assertThat(someTuple.getItem1()).isEqualTo(1); assertThat(someTuple.getItem2()).isEqualTo(2); assertThat(someTuple.getItem3()).isEqualTo(3); assertThat(someTuple.getItem4()).isEqualTo(4); assertThat(someTuple.size()).isEqualTo(4); }
@Override public Object nth(int index) { assertIndexInBounds(index); if (index == 3) { return item4; } else { return super.nth(index); } }
Tuple4 extends Tuple3<T1, T2, T3> implements Tuple { @Override public Object nth(int index) { assertIndexInBounds(index); if (index == 3) { return item4; } else { return super.nth(index); } } }
Tuple4 extends Tuple3<T1, T2, T3> implements Tuple { @Override public Object nth(int index) { assertIndexInBounds(index); if (index == 3) { return item4; } else { return super.nth(index); } } Tuple4(T1 a, T2 b, T3 c, T4 d); }
Tuple4 extends Tuple3<T1, T2, T3> implements Tuple { @Override public Object nth(int index) { assertIndexInBounds(index); if (index == 3) { return item4; } else { return super.nth(index); } } Tuple4(T1 a, T2 b, T3 c, T4 d); static Tuple4<T1, T2, T3, T4> of(T1 a, T2 b, T3 c, T4 d); T4 getItem4(); @Override Object nth(int index); @Override Tuple4<T, T2, T3, T4> mapItem1(Function<T1, T> mapper); @Override Tuple4<T1, T, T3, T4> mapItem2(Function<T2, T> mapper); @Override Tuple4<T1, T2, T, T4> mapItem3(Function<T3, T> mapper); Tuple4<T1, T2, T3, T> mapItem4(Function<T4, T> mapper); @Override List<Object> asList(); @Override int size(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
Tuple4 extends Tuple3<T1, T2, T3> implements Tuple { @Override public Object nth(int index) { assertIndexInBounds(index); if (index == 3) { return item4; } else { return super.nth(index); } } Tuple4(T1 a, T2 b, T3 c, T4 d); static Tuple4<T1, T2, T3, T4> of(T1 a, T2 b, T3 c, T4 d); T4 getItem4(); @Override Object nth(int index); @Override Tuple4<T, T2, T3, T4> mapItem1(Function<T1, T> mapper); @Override Tuple4<T1, T, T3, T4> mapItem2(Function<T2, T> mapper); @Override Tuple4<T1, T2, T, T4> mapItem3(Function<T3, T> mapper); Tuple4<T1, T2, T3, T> mapItem4(Function<T4, T> mapper); @Override List<Object> asList(); @Override int size(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }