private static <K, V> V computeIfAbsent(final Map<K, V> map, final K key, final Function<K, V> mappingFunction) { V v; final V newValue; if ((v = map.get(key)) == null && (newValue = mappingFunction.apply(key)) != null) { if ((v = putIfAbsent(map, key, newValue)) == null) { return newValue; } else { return v; } } else { return v; } }