Different behavior between upsert and alter with regards to key identity
With methods such as upsert
and alter
the important part of behavior is what they do with they key when the value if updated. Even if keys are equal, their identity may be (and often is) actually different and this is important for certain applications.
In chashmap
library it is not documented what happens to key in those methods. In the current implementation they do opposite things: upsert
preserves the old key on updates, while alter
always inserts the new key. The behavior of upsert
makes much more sense to me.
At the very least this should be documented, and ideally the behavior should be consistent.