Skip to content

Commit 9bceeb0

Browse files
author
Abduqodiri Qurbonzoda
committed
Return value on PersistentMap.Builder.put even if entry already exists
1 parent 9b6cf0d commit 9bceeb0

File tree

1 file changed

+4
-1
lines changed
  • kotlinx-collections-immutable/src/main/kotlin/kotlinx/collections/immutable/implementations/immutableMap

1 file changed

+4
-1
lines changed

kotlinx-collections-immutable/src/main/kotlin/kotlinx/collections/immutable/implementations/immutableMap/TrieNode.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,10 @@ internal class TrieNode<K, V>(var dataMap: Int,
422422
val keyIndex = keyDataIndex(keyPosition)
423423

424424
if (key == keyAtIndex(keyIndex)) {
425-
if (valueAtKeyIndex(keyIndex) === value) { return this }
425+
if (valueAtKeyIndex(keyIndex) === value) { // needs discussion
426+
mutator.operationResult = value
427+
return this
428+
}
426429
return mutableUpdateValueAtIndex(keyIndex, value, mutator)
427430
}
428431
mutator.size++

0 commit comments

Comments
 (0)