public class Lists
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Lists.Builder<V> |
Modifier and Type | Method and Description |
---|---|
static <V> Lists.Builder<V> |
builder(java.lang.Class<V> ofType) |
static <V,K> java.util.List<V> |
create(K key) |
static <T extends V,V> |
filter(java.util.Collection<T> original,
java.util.function.Predicate<V> keep)
Efficient replacement for List#stream().filter(keep).collect(Collectors.toList()).
|
static <A,B> java.util.List<B> |
map(java.util.Collection<A> original,
java.util.function.Function<A,B> mapper)
Efficient replacement for List#stream().map(mapper).collect(Collectors.toList()).
|
static <A,B> java.util.Set<B> |
mapUnique(java.util.Collection<A> original,
java.util.function.Function<A,B> mapper)
Efficient replacement for List#stream().map(mapper).collect(Collectors.toSet()).
|
public static <V,K> java.util.List<V> create(K key)
public static <V> Lists.Builder<V> builder(java.lang.Class<V> ofType)
public static <T extends V,V> java.util.List<T> filter(java.util.Collection<T> original, java.util.function.Predicate<V> keep)
T
- Type of the list objectsV
- Supertype for T if exists, T if notoriginal
- Original listkeep
- Condition for keeping on the listpublic static <A,B> java.util.List<B> map(java.util.Collection<A> original, java.util.function.Function<A,B> mapper)
A
- Type of the old list objectsB
- Type of the new list objectsoriginal
- Original listmapper
- Function to change object of type A to type Bpublic static <A,B> java.util.Set<B> mapUnique(java.util.Collection<A> original, java.util.function.Function<A,B> mapper)
A
- Type of the old list objectsB
- Type of the new list objectsoriginal
- Original listmapper
- Function to change object of type A to type B