Skip to content

Instantly share code, notes, and snippets.

@shohiebsense
Created July 26, 2022 10:28
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 shohiebsense/d96789d17c704b7602afb96c5d8899f7 to your computer and use it in GitHub Desktop.
Save shohiebsense/d96789d17c704b7602afb96c5d8899f7 to your computer and use it in GitHub Desktop.
Filter Using List, Filter and Update Extension
inline fun <T> ArrayList<T>.filterAndUpdateList(predicate: (T) -> Boolean) : List<T> {
return filter(predicate = predicate).also { filteredList ->
this.clear()
this.addAll(filteredList)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment