How to send parameters to a reference method in a stream (java 8)?
问题 I have a list of activities(Activity) and I want to determine a data structure of the form Map(String, DateTime) (not Duration or Period; DateTime it's a must) that maps. For each activity the total duration computed over the monitoring period. The class Activity has: activityLabel(String) , startTime(DateTime) , endTime(DateTime) . I use joda time. This is what I have done: Map<String, DateTime> durations = activities.stream().collect(Collectors.toMap( it -> it.activityLabel, it ->new