Skip to content

Instantly share code, notes, and snippets.

@BilalSiddiqui
Created October 23, 2020 06:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BilalSiddiqui/f8b8fa8bcd97f323a86891e89c1e071b to your computer and use it in GitHub Desktop.
Save BilalSiddiqui/f8b8fa8bcd97f323a86891e89c1e071b to your computer and use it in GitHub Desktop.
Searching and sorting in ArrayList of Kotlin
inMemoryCache.filter {
it.name.contains(query, true) ||
(it.description != null && it.description.contains(query, true))
}.sortedWith(compareByDescending<Repo> { it.stars }.thenBy { it.name })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment