public class BatchUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T,U> List<org.apache.commons.lang3.tuple.Pair<U,List<T>>> |
groupByDerived(List<T> values,
Function<T,U> deriver,
BiPredicate<U,U> comparator)
Takes the input
values and batches them together in groups. |
public static <T,U> List<org.apache.commons.lang3.tuple.Pair<U,List<T>>> groupByDerived(List<T> values, Function<T,U> deriver, BiPredicate<U,U> comparator)
values
and batches them together in groups. All values in a given group have the same
derived value. The derived value is computed using the deriver
function. Two derived values are compared
for equality using the comparator
.T
- the type of the valuesU
- the type of the derived valuesvalues
- the input valuesderiver
- the function to compute a derived valuecomparator
- the equality test for derived valuesCopyright © 2019 Nuxeo. All rights reserved.