Skip to content

Commit 35bd79d

Browse files
committed
simplify
1 parent 4186ea0 commit 35bd79d

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/main/kotlin/com/fasterxml/jackson/module/kotlin/ArgumentBucket.kt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,17 @@ internal class ArgumentBucket(
5252
private fun getMaskAddress(index: Int): Pair<Int, Int> = (index / Int.SIZE_BITS) to (index % Int.SIZE_BITS)
5353

5454
/**
55-
* The set argument process, similar to MutableMap's put.
56-
* @return the previous value associated with the key, or `null` if the key was not present in the map.
55+
* Set the argument. The second and subsequent inputs for the same `index` will be ignored.
5756
*/
58-
operator fun set(index: Int, value: Any?): Any? {
57+
operator fun set(index: Int, value: Any?) {
5958
val maskAddress = getMaskAddress(index)
6059

6160
val updatedMask = masks[maskAddress.first] and BIT_FLAGS[maskAddress.second]
6261

63-
return if (updatedMask != masks[maskAddress.first]) {
64-
// If the argument has not been initialized, it counts up and returns null.
62+
if (updatedMask != masks[maskAddress.first]) {
6563
values[index] = value
6664
masks[maskAddress.first] = updatedMask
6765
initializedCount++
68-
69-
null
70-
} else {
71-
// If it has been initialized, it swaps the values and returns the previous value.
72-
values[index].apply { values[index] = value }
7366
}
7467
}
7568

0 commit comments

Comments
 (0)