Updated on 2026-08-14
This commit is contained in:
parent
6f47e7d742
commit
6a5a8300cf
10 changed files with 116 additions and 18 deletions
|
|
@ -64,4 +64,12 @@ inline fun <T> MutableList<T>.addOrReplace(item: T, predicate: (T) -> Boolean) {
|
|||
if (!isReplaced) {
|
||||
add(item)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> List<T>.filterIf(condition: Boolean, predicate: (T) -> Boolean): List<T> {
|
||||
return if (condition) {
|
||||
this.filter(predicate)
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue