Suppose I have a group of bumper cars, which have a size, a color and an identifier (\"car code\") on their sides.
class BumperCar { int size; String col
Check out my library AbacusUtil:
StreamEx.of(bumperCars) .groupBy(c -> Tuple.of(c.getSize(), c.getColor()), BumperCar::getCarCode) .map(e -> new DistGroup(e.getKey()._1, e.getKey()._2, e.getValue()) .toList();