Is there a method on the Option class that works like collect (it takes a partial function), but has a return type of Unit?
That is: map is to collect as foreach is to ?.
Sorry, I'm new to Scala--I've looked over the Option docs and did a little research, but didn't find anything relevant.
I know I can just use match, I was just wondering if there was a simpler solution.
Just use
collectif your function returns aUnitand if it doesn't, don't hold on to it.no harm, no fowl if you discard the return.