What would be the correct way to implement this functional logic with streams?
Stream through list of items
Check if condition 1 passes, if so apply function 1 to the item.
Check if condition 2 passes, if so apply function 2 to the item.
If both conditions do not pass, do nothing.
collect results
Do I create predicates with suppliers or how does this look? I'm not very familiar with functional Java.
You're probably best off with a simple for loop, but you could do:
This operates directly on the underlying list. Use
map
if you want to collect to a different collection (but obviously it depends on the modifying function implementation whether it contains clones or the original, now also modified, objects):If you do not care about the final ordering of items, here's another approach, which you can see gets silly...: