Created
December 17, 2021 11:17
-
-
Save magdamiu/fe7e852f33ddd310f613cc3b11394286 to your computer and use it in GitHub Desktop.
crossinline modifier | High performance with idiomatic Kotlin
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 <T, R : Comparable<R>> Iterable<T>.sortedBy(crossinline selector: (T) -> R?): List<T> { | |
return sortedWith(compareBy(selector)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment