Java stream filter sum of values
问题 I have a class called MonitoredData with which describes an activity, its starting time and ending time. The attributes are activityLabel , startTime , endTime . I have to group and filter these activities, using streams, the activities which have the total duration of more than 10 hours. I managed to make the sum of durations and group them according to the activity using this: Map<String, Long> map4 = new HashMap<String, Long>(); map4 = data.stream() .collect( Collectors.groupingBy(