The GroupBy Operator in SQL is described like this:
"The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns"
This sounds exactly like Arrays.sort(...) or Collections.sort(...) using different Comparators which sort based on the column you want to 'Group By'.