https://kotlinlang.org logo
s

Shawn

07/21/2018, 9:28 PM
Is there an equivalent to
Optional.filter()
maybe defined as an extension to
Any?
that I’m missing? right now I have a lengthy
?.let { if (predicate(it)) it else null }
and I couldn’t help but wonder if there’s a more idiomatic approach?
I’m thinking of `takeIf`/`takeUnless`, thanks google!
rubber duck 2
2 Views