Package com.landawn.abacus.util
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
- Since:
- 0.8
- Author:
- Haiyang Li
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
The Class Tuple1.static final class
The Class Tuple2.static final class
The Class Tuple3.static final class
Tuple.Tuple4<T1,
T2, T3, T4> The Class Tuple4.static final class
The Class Tuple5.static final class
The Class Tuple6.static final class
The Class Tuple7.static final class
The Class Tuple8.static final class
The Class Tuple9. -
Method Summary
Modifier and TypeMethodDescription<E extends Exception>
voidaccept
(Throwables.Consumer<? super TP, E> action) abstract boolean
allNull()
abstract boolean
anyNull()
abstract int
arity()
abstract boolean
<E extends Exception>
u.Optional<TP>filter
(Throwables.Predicate<? super TP, E> predicate) static <T1,
T2, T3> Tuple.Tuple3<T1, T2, T3> flatten
(Tuple.Tuple2<Tuple.Tuple2<T1, T2>, T3> tp) static <T1,
T2, T3, T4, T5>
Tuple.Tuple5<T1,T2, T3, T4, T5> flatten
(Tuple.Tuple3<Tuple.Tuple3<T1, T2, T3>, T4, T5> tp) abstract <E extends Exception>
voidforEach
(Throwables.Consumer<?, E> consumer) static <TP extends Tuple<TP>>
TPstatic <TP extends Tuple<TP>>
TPfrom
(Collection<?> c) static <K,
V> Tuple.Tuple2<K, V> <U,
E extends Exception>
Umap
(Throwables.Function<? super TP, U, E> mapper) static <T1> Tuple.Tuple1<T1>
of
(T1 _1) static <T1,
T2> Tuple.Tuple2<T1, T2> of
(T1 _1, T2 _2) static <T1,
T2, T3> Tuple.Tuple3<T1, T2, T3> of
(T1 _1, T2 _2, T3 _3) static <T1,
T2, T3, T4>
Tuple.Tuple4<T1,T2, T3, T4> of
(T1 _1, T2 _2, T3 _3, T4 _4) static <T1,
T2, T3, T4, T5>
Tuple.Tuple5<T1,T2, T3, T4, T5> of
(T1 _1, T2 _2, T3 _3, T4 _4, T5 _5) 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) 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) 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.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 usingclass Some Entity/Record class: MyRecord { final T1 propName1, final T2 propName2...}
stream()
stream
(Throwables.Function<? super TP, Stream<T>, E> func) abstract Object[]
toArray()
abstract <A> A[]
toArray
(A[] a) static <T> List<T>
toList
(Tuple.Tuple1<? extends T> tp) static <T> List<T>
toList
(Tuple.Tuple2<? extends T, ? extends T> tp) static <T> List<T>
toList
(Tuple.Tuple3<? extends T, ? extends T, ? extends T> tp) static <T> List<T>
toList
(Tuple.Tuple4<? extends T, ? extends T, ? extends T, ? extends T> tp) static <T> List<T>
toList
(Tuple.Tuple5<? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) static <T> List<T>
toList
(Tuple.Tuple6<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) static <T> List<T>
toList
(Tuple.Tuple7<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) static <T> List<T>
toList
(Tuple.Tuple8<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) 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)
-
Method Details
-
arity
public abstract int arity() -
anyNull
public abstract boolean anyNull()- Returns:
-
allNull
public abstract boolean allNull()- Returns:
-
contains
- Parameters:
objToFind
-- Returns:
-
toArray
-
toArray
public abstract <A> A[] toArray(A[] a) - Type Parameters:
A
-- Parameters:
a
-- Returns:
-
forEach
- Type Parameters:
E
-- Parameters:
consumer
-- Throws:
E
- the e
-
accept
- Type Parameters:
E
-- Parameters:
action
-- Throws:
E
- the e
-
map
- 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
-
stream
public <T,E extends Exception> Stream<T> stream(Throwables.Function<? super TP, Stream<T>, throws EE> func) - Throws:
E extends Exception
-
toOptional
- Returns:
-
of
- Type Parameters:
T1
-- Parameters:
_1
- the 1- Returns:
-
of
- Type Parameters:
T1
-T2
-- Parameters:
_1
- the 1_2
- the 2- Returns:
-
of
- Type Parameters:
T1
-T2
-T3
-- Parameters:
_1
- the 1_2
- the 2_3
- the 3- Returns:
-
of
- 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, Tuple.Tuple5<T1,T3, T4, T5> T2, ofT3, T4, T5> (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, Tuple.Tuple6<T1,T3, T4, T5, T6> T2, ofT3, T4, T5, T6> (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, Tuple.Tuple7<T1,T3, T4, T5, T6, T7> T2, ofT3, T4, T5, T6, T7> (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, Tuple.Tuple8<T1,T3, T4, T5, T6, T7, T8> T2, ofT3, T4, T5, T6, T7, T8> (T1 _1, T2 _2, T3 _3, T4 _4, T5 _5, T6 _6, T7 _7, T8 _8) Deprecated.you should consider usingclass Some Entity/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, Tuple.Tuple9<T1,T3, T4, T5, T6, T7, T8, T9> T2, ofT3, T4, T5, T6, T7, T8, T9> (T1 _1, T2 _2, T3 _3, T4 _4, T5 _5, T6 _6, T7 _7, T8 _8, T9 _9) Deprecated.you should consider usingclass Some Entity/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:
-
from
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
entry
-- Returns:
-
from
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
from
- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
toList
-
toList
-
toList
-
toList
@Beta public static <T> List<T> toList(Tuple.Tuple4<? extends T, ? extends T, ? extends T, ? extends T> tp) -
toList
@Beta public static <T> List<T> toList(Tuple.Tuple5<? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) -
toList
@Beta public static <T> List<T> toList(Tuple.Tuple6<? extends T, ? extends T, ? extends T, ? extends T, ? extends T, ? extends T> tp) -
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) -
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) -
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) -
flatten
@Beta public static <T1,T2, Tuple.Tuple3<T1,T3> T2, flattenT3> (Tuple.Tuple2<Tuple.Tuple2<T1, T2>, T3> tp) -
flatten
@Beta public static <T1,T2, Tuple.Tuple5<T1,T3, T4, T5> T2, flattenT3, T4, T5> (Tuple.Tuple3<Tuple.Tuple3<T1, T2, T3>, T4, T5> tp)
-
class Some Entity/Record class: MyRecord { final T1 propName1, final T2 propName2...}