2 ms·
ConcurrentMap has always had putIfAbsent(). That requires the thing that you're putting to have been constructed prior to the call. computeIfAbsent() allows y
by LgWoodenBadger 10y ago
ConcurrentMap has always had putIfAbsent(). That requires the thing that you're putting to have been constructed prior to the call.
computeIfAbsent() allows you to pass in a lambda (a Function really) which will only be called if necessary, thus avoiding a potentially unnecessary Object creation/etc.