mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-08 09:47:09 +00:00
Small performance optimization of MutableMap.applyDiff
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## 0.25.5
|
## 0.25.5
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* Small performance optimization of `MutableMap.applyDiff`
|
||||||
|
|
||||||
## 0.25.4
|
## 0.25.4
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@@ -82,13 +82,11 @@ fun <K, V> MutableMap<K, V>.applyDiff(
|
|||||||
mapDiff: MapDiff<K, V>
|
mapDiff: MapDiff<K, V>
|
||||||
) {
|
) {
|
||||||
mapDiff.apply {
|
mapDiff.apply {
|
||||||
removed.keys.forEach { remove(it) }
|
keys.removeAll(removed.keys)
|
||||||
changed.forEach { (k, oldNew) ->
|
changed.forEach { (k, oldNew) ->
|
||||||
put(k, oldNew.second)
|
put(k, oldNew.second)
|
||||||
}
|
}
|
||||||
added.forEach { (k, new) ->
|
putAll(added)
|
||||||
put(k, new)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user