Skip to content

Tag: java-stream

Java Sort List Based Off Intersections

I’m trying to see how I can sort a list using streams where items that exist in a separate hashset are moved to the front of the list. Example: I’m assuming I can use a lambda in streams.sorted() for this but I’m not able to figure out what this would look like. Answer You can compare the bo…

Java streams – Get max two objects depending on condition

Relatively new to java streams and I have encountered an issue which I could not find a solution for. I have A list of 10 objects and filtered them to return 4 objects. this returns 4 objects: So basically what I am trying to do is take stages that have the same value of stageToCalc and find the maximium stag…