Last active
August 20, 2018 15:02
-
-
Save andremion/f7f3e77e5105cc39fd37761530fd2779 to your computer and use it in GitHub Desktop.
Extension function to filter and map items of a Collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified T> Collection<*>.ofType(): Collection<T> = filter { it is T }.map { it as T } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment