I have a List of Object made in this way:
public class Object{
private Date date;
private double value;
//getters and setters
}
I need to take only Objects with hourly frequence.
My idea was to use a Java8 stream and groupingBy function in this way
Map<Integer, List<Object>> map = objects()
.collect(Collectors.groupingBy(x -> x.getDate().get(ChronoField.HOUR_OF_DAY)));
but in this way i only take 24 elements (one per hour of day) even if I have multiple days in my list. How can i group by day/hour?