feat(util): add ObjectListAggregator
This commit is contained in:
parent
7287d44645
commit
78cacb7eb6
@ -0,0 +1,15 @@
|
||||
package net.tomatentum.marinara.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ObjectListAggregator<O, K, V> extends ObjectAggregator<O, K, ArrayList<V>> {
|
||||
|
||||
public ObjectListAggregator(Function<O, K> keySupplier, Function<O, V> valueConsumer) {
|
||||
super(keySupplier,
|
||||
(l, o) -> l.add(valueConsumer.apply(o)),
|
||||
() -> new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user