I have a class defined like
public class TimePeriodCalc { private double occupancy; private double efficiency; private String atDate; }
You can chain multiple attributes like this:
Collection collector = result.stream().collect(Collectors.groupingBy(p -> p.getAtDate(), Collectors.averagingInt(p -> p.getOccupancy())));
If you want more, you get the idea.