mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-10-25 14:17:14 +00:00
Small performance optimization of MutableMap.applyDiff
This commit is contained in:
1 parent
39415550f5
commit
5f93706d91
2 files changed
+5
-4
No files matched your search
@@ -82,13 +82,11 @@ fun <K, V> MutableMap<K, V>.applyDiff(
|
||||
mapDiff: MapDiff<K, V>
|
||||
) {
|
||||
mapDiff.apply {
|
||||
removed.keys.forEach { remove(it) }
|
||||
keys.removeAll(removed.keys)
|
||||
changed.forEach { (k, oldNew) ->
|
||||
put(k, oldNew.second)
|
||||
}
|
||||
added.forEach { (k, new) ->
|
||||
put(k, new)
|
||||
}
|
||||
putAll(added)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user