applyDiff: Diff

This commit is contained in:
InsanusMokrassar 2022-09-23 16:05:32 +06:00
parent 60bdb59d71
commit 59428140a8
2 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,8 @@
## 0.12.15 ## 0.12.15
* `Common`:
* `applyDiff` will return `Diff` object since this release
* `Coroutines`: * `Coroutines`:
* Add `Flow` extensions `flatMap`, `flatMapNotNull` and `flatten` * Add `Flow` extensions `flatMap`, `flatMapNotNull` and `flatten`
* Add `Flow` extensions `takeNotNull` and `filterNotNull` * Add `Flow` extensions `takeNotNull` and `filterNotNull`

View File

@ -173,7 +173,7 @@ inline fun <T> Iterable<T>.calculateStrictDiff(
fun <T> MutableList<T>.applyDiff( fun <T> MutableList<T>.applyDiff(
source: Iterable<T>, source: Iterable<T>,
strictComparison: Boolean = false strictComparison: Boolean = false
) = calculateDiff(source, strictComparison).let { ): Diff<T> = calculateDiff(source, strictComparison).also {
for (i in it.removed.indices.sortedDescending()) { for (i in it.removed.indices.sortedDescending()) {
removeAt(it.removed[i].index) removeAt(it.removed[i].index)
} }