Skip to content

Instantly share code, notes, and snippets.

@sallySalem
Created February 11, 2018 17:36
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 sallySalem/8564deebd3fd9c109d8008127ec849ff to your computer and use it in GitHub Desktop.
Save sallySalem/8564deebd3fd9c109d8008127ec849ff to your computer and use it in GitHub Desktop.
Sort a list of custom object in Kotlin
//Sort Descending
customList.sortByDescending(CustomModel::date)
.apply {
view?.loadCustomList()
}
//Sort Ascending
customList.sortBy(CustomModel::date)
.apply {
view?.loadCustomList()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment