[concurrency-interest] ConcurrentMap.replace

Eric Zoerner eric.zoerner@gemstone.com
Wed, 03 Dec 2003 18:20:05 -0800


Doug, thanks for adding the two-arg replace method, and I agree with your 
analysis. However, I was expecting the two-arg replace method to return the 
oldValue, not a boolean. I don't have a use case for why it should return the 
oldValue, but it seems like it would provide more information than a boolean. If 
the return value is null, then we know the key didn't exist and the replace 
didn't happen (same as the current return of false). Otherwise we get the object 
that was replaced, similar to the return value from put and putIfAbsent. [Of 
course, if the Map supports null values then there is ambiguity, but that is 
also true of putIfAbsent].

- Eric