Begin forwarded message:
> -------- Пересылаемое сообщение--------
> 17.07.2014, 19:20, "Roman Leventov" <leven...@ya.ru>:
>  
> Map.compute() Javadoc has the following paragraph:
> --------
> The default implementation is equivalent to performing the following steps 
> for this map, then returning the current value or null if absent:
>  
>  V oldValue = map.get(key);
>  V newValue = remappingFunction.apply(key, oldValue);
>  if (oldValue != null ) {
>     if (newValue != null)
>        map.put(key, newValue);
>     else
>        map.remove(key);
>  } else {
>     if (newValue != null)
>        map.put(key, newValue);
>     else
>        return null;
>  }
> --------
> 
> But this code don't correspond neither verbal description of the behaviour 
> nor the actual default implementation in java.util.Map. If the oldValue is 
> null and newValue is null, map should still remove the key, not to just 
> `return null;`
>  

Reply via email to