Class Tuple<TP>

java.lang.Object
com.landawn.abacus.util.Tuple<TP>
All Implemented Interfaces:
Immutable
Direct Known Subclasses:
Tuple.Tuple1, Tuple.Tuple2, Tuple.Tuple3, Tuple.Tuple4, Tuple.Tuple5, Tuple.Tuple6, Tuple.Tuple7, Tuple.Tuple8, Tuple.Tuple9

@Immutable public abstract class Tuple<TP> extends Object implements Immutable
Since:
0.8
Author:
Haiyang Li
  • Method Details

    • arity

      public abstract int arity()
      Returns:
    • anyNull

      public abstract boolean anyNull()
      Returns:
    • allNull

      public abstract boolean allNull()
      Returns:
    • contains

      public abstract boolean contains(Object objToFind)
      Parameters:
      objToFind -
      Returns:
    • toArray

      public abstract Object[] toArray()
      Returns:
    • toArray

      public abstract <A> A[] toArray(A[] a)
      Type Parameters:
      A -
      Parameters:
      a -
      Returns:
    • forEach

      public abstract <E extends Exception> void forEach(Throwables.Consumer<?,E> consumer) throws E
      Type Parameters:
      E -
      Parameters:
      consumer -
      Throws:
      E - the e
    • accept

      public <E extends Exception> void accept(Throwables.Consumer<? super TP,E> action) throws E
      Type Parameters:
      E -
      Parameters:
      action -
      Throws:
      E - the e
    • map

      public <U, E extends Exception> U map(Throwables.Function<? super TP,U,E> mapper) throws E
      Type Parameters:
      U -
      E -
      Parameters:
      mapper -
      Returns:
      Throws:
      E - the e
    • filter

      public <E extends Exception> u.Optional<TP> filter(Throwables.Predicate<? super TP,E> predicate) throws E
      Type Parameters:
      E -
      Parameters:
      predicate -
      Returns:
      Throws:
      E - the e
    • stream

      public Stream<TP> stream()
      Returns:
    • stream

      public <T, E extends Exception> Stream<T> stream(Throwables.Function<? super TP,Stream<T>,E> func) throws E
      Type Parameters:
      T -
      E -
      Parameters:
      func -
      Returns:
      Throws:
      E
    • toOptional

      public u.Optional<TP> toOptional()
      Returns:
    • of

      public static <T1> Tuple.Tuple1<T1> of(T1 _1)
      Type Parameters:
      T1 -
      Parameters:
      _1 - the 1
      Returns:
    • of

      public static <T1, T2> Tuple.Tuple2<T1,T2> of(T1 _1, T2 _2)
      Type Parameters:
      T1 -
      T2 -
      Parameters:
      _1 - the 1
      _2 - the 2
      Returns:
    • of

      public static <T1, T2, T3> Tuple.Tuple3<T1,T2,T3> of(T1 _1, T2 _2, T3 _3)
      Type Parameters:
      T1 -
      T2 -
      T3 -
      Parameters:
      _1 - the 1
      _2 - the 2
      _3 - the 3
      Returns:
    • of

      public static <T1, T2, T3, T4> Tuple.Tuple4<T1,T2,T3,T4> of(T1 _1, T2 _2, T3 _3, T4 _4)
      Type Parameters:
      T1 -
      T2 -
      T3 -
      T4 -
      Parameters:
      _1 - the 1
      _2 - the 2
      _3 - the 3
      _4 - the 4
      Returns:
    • of

      public static <T1, T2, T3, T4, T5> Tuple.Tuple5<T1,T2,T3,T4,T5> of(T1 _1, T2 _2, T3 _3, T4 _4, T5 _5)
      Type Parameters:
      T1 -
      T2 -
      T3 -
      T4 -
      T5 -
      Parameters:
      _1 - the 1
      _2 - the 2
      _3 - the 3
      _4 - the 4
      _5 - the 5
      Returns:
    • of

      public static <T1, T2, T3, T4, T5, T6> Tuple.Tuple6<T1,T2,T3,T4,T5,T6> of(T1 _1, T2 _2, T3 _3, T4 _4, T5 _5, T6 _6)
      Type Parameters:
      T1 -
      T2 -
      T3 -
      T4 -
      T5 -
      T6 -
      Parameters:
      _1 - the 1
      _2 - the 2
      _3 - the 3
      _4 - the 4
      _5 - the 5
      _6 - the 6
      Returns:
    • of

      public static <T1, T2, T3, T4, T5, T6, T7> Tuple.Tuple7<T1,T2,T3,T4,T5,T6,T7> of(T1 _1, T2 _2, T3 _3, T4 _4, T5 _5, T6 _6, T7 _7)
      Type Parameters:
      T1 -
      T2 -
      T3 -
      T4 -
      T5 -
      T6 -
      T7 -
      Parameters:
      _1 - the 1
      _2 - the 2
      _3 - the 3
      _4 - the 4
      _5 - the 5
      _6 - the 6
      _7 - the 7
      Returns:
    • of

      @Deprecated public static <T1, T2, T3, T4, T5, T6, T7, T8> Tuple.Tuple8<T1,T2,T3,T4,T5,T6,T7,T8> of(T1 _1, T2 _2, T3 _3, T4 _4, T5 _5, T6 _6, T7 _7, T8 _8)
      Deprecated.
      you should consider using class Some Bean/Record class: MyRecord { final T1 propName1, final T2 propName2...}
      Type Parameters:
      T1 -
      T2 -
      T3 -
      T4 -
      T5 -
      T6 -
      T7 -
      T8 -
      Parameters:
      _1 - the 1
      _2 - the 2
      _3 - the 3
      _4 - the 4
      _5 - the 5
      _6 - the 6
      _7 - the 7
      _8 - the 8
      Returns:
    • of

      @Deprecated public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Tuple.Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9> of(T1 _1, T2 _2, T3 _3, T4 _4, T5 _5, T6 _6, T7 _7, T8 _8, T9 _9)
      Deprecated.
      you should consider using class Some Bean/Record class: MyRecord { final T1 propName1, final T2 propName2...}
      Type Parameters:
      T1 -
      T2 -
      T3 -
      T4 -
      T5 -
      T6 -
      T7 -
      T8 -
      T9 -
      Parameters:
      _1 - the 1
      _2 - the 2
      _3 - the 3
      _4 - the 4
      _5 - the 5
      _6 - the 6
      _7 - the 7
      _8 - the 8
      _9 - the 9
      Returns:
    • create

      @Beta public static <K, V> Tuple.Tuple2<K,V> create(Map.Entry<K,V> entry)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      entry -
      Returns:
    • create

      @Beta public static <TP extends Tuple<TP>> TP create(Object[] a)
      Type Parameters:
      TP -
      Parameters:
      a -
      Returns:
    • create

      @Beta public static <TP extends Tuple<TP>> TP create(Collection<?> c)
      Type Parameters:
      TP -
      Parameters:
      c -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple1<? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple2<? extends T,? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple3<? extends T,? extends T,? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple4<? extends T,? extends T,? extends T,? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple5<? extends T,? extends T,? extends T,? extends T,? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple6<? extends T,? extends T,? extends T,? extends T,? extends T,? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple7<? extends T,? extends T,? extends T,? extends T,? extends T,? extends T,? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple8<? extends T,? extends T,? extends T,? extends T,? extends T,? extends T,? extends T,? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • toList

      @Beta public static <T> List<T> toList(Tuple.Tuple9<? extends T,? extends T,? extends T,? extends T,? extends T,? extends T,? extends T,? extends T,? extends T> tp)
      Type Parameters:
      T -
      Parameters:
      tp -
      Returns:
    • flatten

      @Beta public static <T1, T2, T3> Tuple.Tuple3<T1,T2,T3> flatten(Tuple.Tuple2<Tuple.Tuple2<T1,T2>,T3> tp)
      Type Parameters:
      T1 -
      T2 -
      T3 -
      Parameters:
      tp -
      Returns:
    • flatten

      @Beta public static <T1, T2, T3, T4, T5> Tuple.Tuple5<T1,T2,T3,T4,T5> flatten(Tuple.Tuple3<Tuple.Tuple3<T1,T2,T3>,T4,T5> tp)
      Type Parameters:
      T1 -
      T2 -
      T3 -
      T4 -
      T5 -
      Parameters:
      tp -
      Returns: