Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Created December 17, 2021 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magdamiu/fe7e852f33ddd310f613cc3b11394286 to your computer and use it in GitHub Desktop.
Save magdamiu/fe7e852f33ddd310f613cc3b11394286 to your computer and use it in GitHub Desktop.
crossinline modifier | High performance with idiomatic Kotlin
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