[concurrency-interest] generalise computeIfAbsent() for ConcurrentMap
Alex Lam S.L.
alexlamsl at gmail.com
Wed Jun 20 09:17:39 EDT 2012
I am happily trying out the new computeIfAbsent() at the moment - it
saves a lot of headache for instance when I have to do an extra get()
before putIfAbsent() just because the potentially duplicated value
would create too much memory pressure.
In same places however I do use the other ConcurrentMap
implementation, i.e. ConcurrentSkipListMap. I notice that
computeIfAbsent() is implemented explicitly for ConcurrentHashMap
instead; even the mapping functions are under ConcurrentHashMap
instead of the ConcurrentMap interface.
Any reasons why this cannot be done for ConcurrentSkipListMap as well?
Or have I been doing something wrong altogether?
More information about the Concurrency-interest