MCPcopy Index your code
hub / github.com/google/dagger / reentrantComputeIfAbsent

Method reentrantComputeIfAbsent

java/dagger/internal/codegen/Util.java:90–100  ·  view source on GitHub ↗

A version of Map#computeIfAbsent(Object, Function) that allows mappingFunction to update map.

(
      Map<K, V> map, K key, Function<? super K, ? extends V> mappingFunction)

Source from the content-addressed store, hash-verified

88 * to update {@code map}.
89 */
90 static <K, V> V reentrantComputeIfAbsent(
91 Map<K, V> map, K key, Function<? super K, ? extends V> mappingFunction) {
92 V value = map.get(key);
93 if (value == null) {
94 value = mappingFunction.apply(key);
95 if (value != null) {
96 map.put(key, value);
97 }
98 }
99 return value;
100 }
101
102 private Util() {}
103}

Callers 7

getOrCreateMethod · 0.80
validateMethod · 0.80
validateMethod · 0.80
getExpressionMethod · 0.80
reportMethod · 0.80
validateMethod · 0.80

Calls 3

getMethod · 0.65
applyMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected