sortByGroupDesc
Sorts the key-group pairs of this GroupBy by a value computed for each group using the specified expression descending.
DataFrameExpression is a lambda that receives each group as a DataFrame, both as the receiver (this) and as the lambda argument (it), and returns the value used to order the groups.
Returns a new GroupBy containing the same keys and groups in the resulting order. The contents of the groups remain unchanged.
Don't confuse this with sortByDesc that sorts rows within groups.
See also
sortByGroupthat sorts the key-group pairs of thisGroupBybased on computed values ascending.sortByCountandsortByCountAscthat sort the key-group pairs of thisGroupByby the group sizes.sortByKeyandsortByKeyDescthat sort the key-group pairs of thisGroupByby the key values.
Check out .GroupBy grammar
For more information: See "GroupBy Transformation" on the documentation website.
Example
// Sorts groups by the product of their size and the maximum value of the "quantity" column descending
gb.sortByGroupDesc { group -> group.rowsCount() * group.quantity.max() }Return
A new GroupBy with its key-group pairs sorted by the values produced by expression.
Parameters
Whether null values are considered as the largest values when sorting. Default is false.
The expression used to compute the sorting value for each group.