/** * Create a {@link Tuple1} with the given object. * * @param t1 The first value in the tuple. * @param <T1> The type of the first value. * @return The new {@link Tuple1}. */ public static <T1> Tuple1<T1> of(T1 t1) { return new Tuple1<T1>(1, t1); }
/** * Create a {@link TupleN} with the given object. * * @param list Build an unbounded tuple * @return The new {@link TupleN}. */ @SuppressWarnings("rawtypes") public static TupleN of(Object[] list) { return new TupleN(list); }
/** * Create a {@link Tuple2} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @return The new {@link Tuple2}. */ public static <T1, T2> Tuple2<T1, T2> of(T1 t1, T2 t2) { return new Tuple2<T1, T2>(2, t1, t2); }
public Tuple2<K, V> pair() { return Tuple.of(key, value); }
@Override public Object getT8() { return get(7); }
/** * Create a {@link Tuple3} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param t3 The third value in the tuple. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @return The new {@link Tuple3}. */ public static <T1, T2, T3> Tuple3<T1, T2, T3> of(T1 t1, T2 t2, T3 t3) { return new Tuple3<T1, T2, T3>(3, t1, t2, t3); }
/** * Create a {@link Tuple4} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param t3 The third value in the tuple. * @param t4 The fourth value in the tuple. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @param <T4> The type of the fourth value. * @return The new {@link Tuple4}. */ public static <T1, T2, T3, T4> Tuple4<T1, T2, T3, T4> of(T1 t1, T2 t2, T3 t3, T4 t4) { return new Tuple4<T1, T2, T3, T4>(4, t1, t2, t3, t4); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (t3 != null ? t3.hashCode() : 0); return result; }
@Override public String toString() { return super.toString()+ (t2 != null ? ","+t2.toString() : ""); } }
@Override public String toString() { return super.toString()+ (t5 != null ? ","+t5.toString() : ""); } }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (t1 != null ? t1.hashCode() : 0); return result; }
@Override public V apply(LEFT left, RIGHT right) { return function.apply(Tuple2.of(left, right)); } };
@Override public Tuple5<T1, T2, T3, T4, T5> apply(List<Object> objects) { return Tuple.of((T1) objects.get(0), (T2) objects.get(1), (T3) objects.get(2), (T4) objects.get(3), (T5) objects.get(4)); } });
@Override public Object getT1() { return get(0); }
@Override public Object getT2() { return get(1); }
@Override public Object getT5() { return get(4); }
@Override public Object getT3() { return get(2); }
@Override public Object getT7() { return get(6); }
@Override public Object getT6() { return get(5); }
@Override public Object getT4() { return get(3); }