public class FpKit extends Object
Constructor and Description |
---|
FpKit() |
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
concat(List<T> l1,
List<T> l2)
Concatenates two lists into one
|
static <T> List<T> |
concat(List<T> l,
T t)
Concatenates (appends) a single elements to an existing list
|
static <T> Optional<T> |
findOne(List<T> list,
Predicate<T> filter) |
static <T> T |
findOneOrNull(List<T> list,
Predicate<T> filter) |
static <T> CompletableFuture<List<T>> |
flatList(CompletableFuture<List<List<T>>> cf) |
static <T> List<T> |
flatList(List<List<T>> listLists) |
static <T> Map<String,T> |
getByName(List<T> namedObjects,
Function<T,String> nameFn) |
static <T> Map<String,T> |
getByName(List<T> namedObjects,
Function<T,String> nameFn,
BinaryOperator<T> mergeFunc) |
static <T,NewKey> Map<NewKey,List<T>> |
groupingBy(List<T> list,
Function<T,NewKey> function) |
static <T,U> List<U> |
map(List<T> list,
Function<T,U> function) |
static <K,V,U> List<U> |
mapEntries(Map<K,V> map,
BiFunction<K,V,U> function) |
static <T> BinaryOperator<T> |
mergeFirst() |
static <T> Collection<T> |
toCollection(Object iterableResult)
Converts an object that should be an Iterable into a Collection efficiently, leaving
it alone if it is already is one.
|
static <T> List<List<T>> |
transposeMatrix(List<? extends List<T>> matrix) |
static <T> List<T> |
valuesToList(Map<?,T> map) |
public static <T> Map<String,T> getByName(List<T> namedObjects, Function<T,String> nameFn, BinaryOperator<T> mergeFunc)
public static <T,NewKey> Map<NewKey,List<T>> groupingBy(List<T> list, Function<T,NewKey> function)
public static <T> Map<String,T> getByName(List<T> namedObjects, Function<T,String> nameFn)
public static <T> BinaryOperator<T> mergeFirst()
public static <T> Collection<T> toCollection(Object iterableResult)
T
- the type of thingiterableResult
- the result objectClassCastException
- if its not an Iterablepublic static <T> List<T> concat(List<T> l, T t)
T
- the type of elements of the listl
- the list onto which to append the elementt
- the element to appendpublic static <T> List<T> concat(List<T> l1, List<T> l2)
T
- the type of element of the listsl1
- the first list to concatenatel2
- the second list to concatenatepublic static <K,V,U> List<U> mapEntries(Map<K,V> map, BiFunction<K,V,U> function)
public static <T> CompletableFuture<List<T>> flatList(CompletableFuture<List<List<T>>> cf)
Copyright © 2019. All rights reserved.