public final class Tuples extends Object
Modifier and Type | Method and Description |
---|---|
static Class<? extends org.javatuples.Tuple> |
classOfTuple(Collection<?> objects)
Returns the tuple class corresponding to the collection size.
|
static Class<? extends org.javatuples.Tuple> |
classOfTuple(int cardinality)
Returns the tuple class corresponding to the specified cardinality.
|
static Class<? extends org.javatuples.Tuple> |
classOfTuple(Object... objects)
Returns the tuple class corresponding to the array size.
|
static <T extends org.javatuples.Tuple> |
create(Collection<?> objects)
Builds a tuple from a collection of objects.
|
static <T extends org.javatuples.Tuple> |
create(Iterable<?> objects)
Builds a tuple from an
Iterable . |
static <T extends org.javatuples.Tuple> |
create(Iterable<?> objects,
int limit)
Builds a tuple from an
Iterable , optionally limiting the number of items. |
static <T extends org.javatuples.Tuple> |
create(Object... objects)
Builds a tuple from an array of objects.
|
static <T> Class<T>[] |
itemClasses(org.javatuples.Tuple tuple)
Returns a list containing the classes of the elements of the tuple.
|
static ParameterizedType |
typeOfTuple(Class<?>... classes)
Returns the
ParameterizedType of the Tuple class corresponding to the specified
classes. |
public static <T extends org.javatuples.Tuple> T create(Collection<?> objects)
T
- the tuple type.objects
- the collection of objects (size must be less or equal than 10).public static <T extends org.javatuples.Tuple> T create(Object... objects)
T
- the tuple type.objects
- the collection of objects (size must be less or equal than 10).public static <T extends org.javatuples.Tuple> T create(Iterable<?> objects, int limit)
Iterable
, optionally limiting the number of items.T
- the tuple type.objects
- the iterable of objects (size must be less or equal than 10).limit
- the item number limit (-1 means no limit).public static <T extends org.javatuples.Tuple> T create(Iterable<?> objects)
Iterable
.T
- the tuple type.objects
- the iterable of objects (size must be less or equal than 10).public static Class<? extends org.javatuples.Tuple> classOfTuple(Collection<?> objects)
objects
- the collection of objects (size must be less or equal than 10).public static Class<? extends org.javatuples.Tuple> classOfTuple(Object... objects)
objects
- the array of objects (size must be less or equal than 10).public static Class<? extends org.javatuples.Tuple> classOfTuple(int cardinality)
cardinality
- the cardinality (must be less or equal than 10).public static ParameterizedType typeOfTuple(Class<?>... classes)
ParameterizedType
of the Tuple class corresponding to the specified
classes. For instance, for a list with Customer.class and Order.class the method will return Pair<Customer, Order>.
classes
- the tuple classes.public static <T> Class<T>[] itemClasses(org.javatuples.Tuple tuple)
T
- the common of the classes contained by the tuple.tuple
- the tuple to convert.Copyright © 2013-2018–2019 SeedStack. All rights reserved.