I wonder why the Map method computeIfAbsent take a Function to calculate the value and not a Supplier.
map.computeIfAbsent(key, key::toString); // Supplier<V>
map.computeIfAbsent(key, k -> k.toString()); // Function<K, V>
Here, the keys "key" and "k" are exactly the same Object
It's particularly strange when the key isn't used. Like in multi map :
// Have to do this :
multiMap.computeIfAbsent(key, __ -> new ArrayList<>()).add(value);
// instead of :
multiMap.computeIfAbsent(key, ArrayList::new).add(value);
Why did Java developers do this ?