From 59428140a8653913e6cfd26977f90d8fad5ee3c4 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 23 Sep 2022 16:05:32 +0600 Subject: [PATCH] applyDiff: Diff --- CHANGELOG.md | 2 ++ .../commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aba0a1b17b4..534b61c91e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.12.15 +* `Common`: + * `applyDiff` will return `Diff` object since this release * `Coroutines`: * Add `Flow` extensions `flatMap`, `flatMapNotNull` and `flatten` * Add `Flow` extensions `takeNotNull` and `filterNotNull` diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt index f885b9f2ba1..596e413fa21 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt @@ -173,7 +173,7 @@ inline fun Iterable.calculateStrictDiff( fun MutableList.applyDiff( source: Iterable, strictComparison: Boolean = false -) = calculateDiff(source, strictComparison).let { +): Diff = calculateDiff(source, strictComparison).also { for (i in it.removed.indices.sortedDescending()) { removeAt(it.removed[i].index) }