yeah, we have a bunch of extensions for things lik...
# announcements
k
yeah, we have a bunch of extensions for things like that that make use of
takeIf
internally. We just do it so frequently on a few types that it makes sense to make it look a little cleaner:
Copy code
fun <T : CharSequence> T?.takeIfNotEmpty(): T? = this?.takeIf(CharSequence::isNotEmpty)
fun <T : Collection<*>> T?.takeIfNotEmpty(): T? = this?.takeIf(Collection<*>::isNotEmpty)
fun <T : Map<*, *>> T?.takeIfNotEmpty(): T? = this?.takeIf(Map<*, *>::isNotEmpty)