Looking at the implementation of the default method putIfAbsent in the interface Map,
default V putIfAbsent(K key, V value) {
V v = get(key);
if (v == null) {
v = put(key, value);
}
return v;
}
I wonder why the assignment
v = put(key, value);
was done there instead of simply discarding the returned value? This assignment seems unnecessary because v is already null, and that is what the put method, according to its contract, always returns in this case.