I have an Option of string, say O, which can be empty. And there is a condition, say cond. My requirement is to construct Option of the value inside O if cond is true, else None. I do this:
Option.unless(cond)(o.getOrElse(None))
Is this a correct functional way of doing it? Or there can be a better/cleaner/easy to understand way?