Package com.landawn.abacus.util
Class Tuple<TP>
- java.lang.Object
-
- com.landawn.abacus.util.Tuple<TP>
-
- Direct Known Subclasses:
Tuple.Tuple1
,Tuple.Tuple2
,Tuple.Tuple3
,Tuple.Tuple4
,Tuple.Tuple5
,Tuple.Tuple6
,Tuple.Tuple7
,Tuple.Tuple8
,Tuple.Tuple9
public abstract class Tuple<TP> extends Object
The Class Tuple.- Since:
- 0.8
- Author:
- Haiyang Li
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Tuple.Tuple1<T1>
The Class Tuple1.static class
Tuple.Tuple2<T1,T2>
The Class Tuple2.static class
Tuple.Tuple3<T1,T2,T3>
The Class Tuple3.static class
Tuple.Tuple4<T1,T2,T3,T4>
The Class Tuple4.static class
Tuple.Tuple5<T1,T2,T3,T4,T5>
The Class Tuple5.static class
Tuple.Tuple6<T1,T2,T3,T4,T5,T6>
The Class Tuple6.static class
Tuple.Tuple7<T1,T2,T3,T4,T5,T6,T7>
The Class Tuple7.static class
Tuple.Tuple8<T1,T2,T3,T4,T5,T6,T7,T8>
The Class Tuple8.static class
Tuple.Tuple9<T1,T2,T3,T4,T5,T6,T7,T8,T9>
The Class Tuple9.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <E extends Exception>
voidaccept(Throwables.Consumer<? super TP,E> action)
abstract boolean
allNull()
abstract boolean
anyNull()
abstract int
arity()
abstract boolean
contains(Object objToFind)
<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)
abstract <E extends Exception>
voidforEach(Throwables.Consumer<?,E> consumer)
static <TP extends Tuple<TP>>
TPfrom(Object[] a)
static <TP extends Tuple<TP>>
TPfrom(Collection<?> c)
static <K,V>
Tuple.Tuple2<K,V>from(Map.Entry<K,V> entry)
<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)
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)
Stream<TP>
stream()
<T,E extends Exception>
Stream<T>stream(Throwables.Function<? super TP,Stream<T>,E> func)
abstract Object[]
toArray()
abstract <A> A[]
toArray(A[] a)
u.Optional<TP>
toOptional()
-
-
-
Method Detail
-
arity
public abstract int arity()
- Returns:
-
anyNull
public abstract boolean anyNull()
- Returns:
- true, if successful
-
allNull
public abstract boolean allNull()
- Returns:
- true, if successful
-
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 extends Exception
- Type Parameters:
E
-- Parameters:
consumer
-- Throws:
E
- the eE extends Exception
-
accept
public <E extends Exception> void accept(Throwables.Consumer<? super TP,E> action) throws E extends Exception
- Type Parameters:
E
-- Parameters:
action
-- Throws:
E
- the eE extends Exception
-
map
public <U,E extends Exception> U map(Throwables.Function<? super TP,U,E> mapper) throws E extends Exception
- Type Parameters:
U
-E
-- Parameters:
mapper
-- Returns:
- Throws:
E
- the eE extends Exception
-
filter
public <E extends Exception> u.Optional<TP> filter(Throwables.Predicate<? super TP,E> predicate) throws E extends Exception
- Type Parameters:
E
-- Parameters:
predicate
-- Returns:
- Throws:
E
- the eE extends Exception
-
stream
public <T,E extends Exception> Stream<T> stream(Throwables.Function<? super TP,Stream<T>,E> func) throws E extends Exception
- Returns:
- Throws:
E extends Exception
-
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
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)
- 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
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)
- 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
public static <K,V> Tuple.Tuple2<K,V> from(Map.Entry<K,V> entry)
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
entry
-- Returns:
-
from
public static <TP extends Tuple<TP>> TP from(Object[] a)
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
from
public static <TP extends Tuple<TP>> TP from(Collection<?> c)
- Type Parameters:
T
-- Parameters:
c
-- Returns:
-
flatten
public static <T1,T2,T3> Tuple.Tuple3<T1,T2,T3> flatten(Tuple.Tuple2<Tuple.Tuple2<T1,T2>,T3> tp)
-
-