Class Lists
java.lang.Object
com.djrapitops.plan.utilities.java.Lists
Methods that can be used as functional interfaces when dealing with Maps.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V> Lists.Builder<V>
static <V,
K> List<V> create
(K key) static <T extends V,
V>
List<T>filter
(Collection<T> original, Predicate<V> keep) Efficient replacement for List#stream().filter(keep).collect(Collectors.toList()).static <A,
B> List<B> map
(Collection<A> original, Function<A, B> mapper) Efficient replacement for List#stream().map(mapper).collect(Collectors.toList()).static <A,
B> Set<B> mapUnique
(Collection<A> original, Function<A, B> mapper) Efficient replacement for List#stream().map(mapper).collect(Collectors.toSet()).
-
Method Details
-
create
-
builder
-
filter
Efficient replacement for List#stream().filter(keep).collect(Collectors.toList()).- Type Parameters:
T
- Type of the list objectsV
- Supertype for T if exists, T if not- Parameters:
original
- Original listkeep
- Condition for keeping on the list- Returns:
- List with elements in original that keep returned true for.
-
map
Efficient replacement for List#stream().map(mapper).collect(Collectors.toList()).- Type Parameters:
A
- Type of the old list objectsB
- Type of the new list objects- Parameters:
original
- Original listmapper
- Function to change object of type A to type B- Returns:
- List with elements in original that keep returned true for.
-
mapUnique
Efficient replacement for List#stream().map(mapper).collect(Collectors.toSet()).- Type Parameters:
A
- Type of the old list objectsB
- Type of the new list objects- Parameters:
original
- Original listmapper
- Function to change object of type A to type B- Returns:
- List with elements in original that keep returned true for.
-