Hi, I have a suggestion for new methods in java.util.Map. As of Java 25, we have the method:
default V getOrDefault(Object key, V defaultValue) However, I think it could be interesting a method where the defaultValue is passed as a lambda function like this one: default V getOrDefault(Object key, Function<? super K, ? extends V> defaultValueFunction) Also, other two new methods might be interesting if you want to get a value from a map, but if the key doesn't exist you want to insert that value in the map and return it: default V getOrPut(Object key, V defaultValue) default V getOrPut(Object key, Function<? super K, ? extends V> defaultValueFunction) What do you think? Regards, Alberto.
