Java 8 Streams - advanced usage of filter and map with overlapping period
Java 8 Streams - advanced usage of filter and map with overlapping period
I'm struggling to try to use Java 8 stream in this scenario. I have a list of plans being that each plan has its own version number and period. Given that a list of plans I have to consider only the latest version of each week/year. For instance:
public class Period {
int year;
int week;
}
public class Plan {
Period start;
Period end;
int version;
}
public class WeeklyPlan {
int week;
int year;
Plan plan;//latest version
}
List of plans...
The outcome should be a list of WeeklyPlan with:
What is the best way to implement that using Java 8 stream?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Whoever up-voted this, please don't -- the OP hasn't shown any attempt yet at all, or told us yet what problems he's had with his attempts
– Hovercraft Full Of Eels
1 min ago