public final class Collections extends Object
Modifier and Type | Method and Description |
---|---|
static <T,U> Map<U,T> |
indexBy(Iterable<T> inputs,
Mapper<T,U> indexer)
Index list of inputs by result of mapper function.
|
static <T> boolean |
isEmpty(Collection<T> values)
Check if collection is empty (
null or empty). |
static <T> String |
join(Collection<T> values,
String separator)
Join elements of collection to a final string.
|
static <T,U> List<U> |
map(List<T> inputs,
Mapper<T,U> mapper)
Map list of inputs to a new list of outputs.
|
static <T> int |
size(Collection<T> values)
Get size of collection.
|
public static <T> boolean isEmpty(Collection<T> values)
null
or empty).T
- Type of element in collection.values
- Collection of values.public static <T> int size(Collection<T> values)
T
- Type of element in collection.values
- Collection of values.public static <T> String join(Collection<T> values, String separator)
T
- Type of element in collection.values
- Collection of values.separator
- Separator, use to separate each elements.public static <T,U> List<U> map(List<T> inputs, Mapper<T,U> mapper)
T
- Type of input.U
- Type of output.inputs
- Input list.mapper
- Mapper used to transform inputs.public static <T,U> Map<U,T> indexBy(Iterable<T> inputs, Mapper<T,U> indexer)
T
- Type of input.U
- Type of index keys.inputs
- List of inputs.indexer
- Mapper function.Copyright © 2016. All Rights Reserved.