The latter is unfortunately not possible as written here due to covariance/contravariance clash.
This would not only ease the use of mutable maps in situations where a value must be put into the map when there is no value mapped to the key yet, but also enable the atomical usage of Java concurrent Maps in the same manner as standard Maps.
Interface
MapMutator<Key, Item>
should have a methodwhich should be refined in
MutableMap
asThere should be also
MapMutator
methods along the lines ofwhich should be refined in
MutableMap
somehow like (as close as possible to)The latter is unfortunately not possible as written here due to covariance/contravariance clash.
This would not only ease the use of mutable maps in situations where a value must be put into the map when there is no value mapped to the key yet, but also enable the atomical usage of Java concurrent Maps in the same manner as standard Maps.