Created
July 26, 2022 10:28
-
-
Save shohiebsense/d96789d17c704b7602afb96c5d8899f7 to your computer and use it in GitHub Desktop.
Filter Using List, Filter and Update Extension
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> 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