aboutsummaryrefslogtreecommitdiff
path: root/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava/src/com/google/common/util/concurrent/AtomicLongMap.java')
-rw-r--r--guava/src/com/google/common/util/concurrent/AtomicLongMap.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
index 28481cca5..4ede5d606 100644
--- a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
+++ b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
@@ -17,6 +17,7 @@
package com.google.common.util.concurrent;
import static com.google.common.base.Preconditions.checkNotNull;
+import static java.util.Objects.requireNonNull;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.J2ktIncompatible;
@@ -147,8 +148,11 @@ public final class AtomicLongMap<K> implements Serializable {
@CanIgnoreReturnValue
public long updateAndGet(K key, LongUnaryOperator updaterFunction) {
checkNotNull(updaterFunction);
- return map.compute(
- key, (k, value) -> updaterFunction.applyAsLong((value == null) ? 0L : value.longValue()));
+ Long result =
+ map.compute(
+ key,
+ (k, value) -> updaterFunction.applyAsLong((value == null) ? 0L : value.longValue()));
+ return requireNonNull(result);
}
/**
@@ -329,7 +333,7 @@ public final class AtomicLongMap<K> implements Serializable {
return oldValue;
}
});
- return noValue.get() ? 0L : result.longValue();
+ return noValue.get() ? 0L : requireNonNull(result).longValue();
}
/**