Package com.gengoai.tuple
Class Tuples
- java.lang.Object
-
- com.gengoai.tuple.Tuples
-
public final class Tuples extends Object
Static constructor methods for Tuples using the pattern
&(....);
- Author:
- David B. Bracewell
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Tuple0
$()
Creates a tuple of degree zero.static Tuple
$(@NonNull Object... items)
Creates a tuple from the given array of itemsstatic <F> Tuple1<F>
$(F first)
Creates a tuple of degree one.static <F,S>
Tuple2<F,S>$(F first, S second)
Creates a pair.static <F,S,T>
Tuple3<F,S,T>$(F first, S second, T third)
Creates a triple from the given itemsstatic <F,S,T,D>
Tuple4<F,S,T,D>$(F first, S second, T third, D fourth)
Creates a tuple with degree four.static Tuple
$(List<?> list)
Creates a tuple from a list of items.
-
-
-
Method Detail
-
$
public static Tuple $(List<?> list)
Creates a tuple from a list of items. Empty or null lists return a 0-degree tuple.
- Parameters:
list
- the list of objects.- Returns:
- the tuple
-
$
public static <F,S,T> Tuple3<F,S,T> $(F first, S second, T third)
Creates a triple from the given items- Type Parameters:
F
- the first type parameterS
- the second type parameterT
- the third type parameter- Parameters:
first
- the first itemsecond
- the second itemthird
- the third item- Returns:
- the triple
-
$
public static <F,S,T,D> Tuple4<F,S,T,D> $(F first, S second, T third, D fourth)
Creates a tuple with degree four.- Type Parameters:
F
- the first type parameterS
- the second type parameterT
- the third type parameterD
- the fourth type parameter- Parameters:
first
- the first itemsecond
- the second itemthird
- the third itemfourth
- the fourth item- Returns:
- the quadruple
-
$
public static <F,S> Tuple2<F,S> $(F first, S second)
Creates a pair.- Type Parameters:
F
- the first type parameterS
- the second type parameter- Parameters:
first
- the first itemsecond
- the second item- Returns:
- the pair
-
$
public static Tuple0 $()
Creates a tuple of degree zero.- Returns:
- the tuple with degree zero.
-
$
public static <F> Tuple1<F> $(F first)
Creates a tuple of degree one.- Type Parameters:
F
- the first type parameter- Parameters:
first
- the first item- Returns:
- the tuple of degree one.
-
-