Package org.nuxeo.common.utils
Class BatchUtils
- java.lang.Object
-
- org.nuxeo.common.utils.BatchUtils
-
public class BatchUtils extends Object
Batching utilities.- Since:
- 10.10
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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 inputvalues
and batches them together in groups.
-
-
-
Method Detail
-
groupByDerived
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)
Takes the inputvalues
and batches them together in groups. All values in a given group have the same derived value. The derived value is computed using thederiver
function. Two derived values are compared for equality using thecomparator
.- Type Parameters:
T
- the type of the valuesU
- the type of the derived values- Parameters:
values
- the input valuesderiver
- the function to compute a derived valuecomparator
- the equality test for derived values- Returns:
- a list of pairs with a derived values and the corresponding batch
- Since:
- 10.10
-
-