Radiancebobo commented on code in PR #3706:
URL: https://github.com/apache/bookkeeper/pull/3706#discussion_r1051784828
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/util/collections/ConcurrentLongHashMap.java:
##########
@@ -382,6 +382,9 @@ V get(long key, int keyHash) {
}
V put(long key, V value, int keyHash, boolean onlyIfAbsent,
LongFunction<V> valueProvider) {
+ if (value == null) {
+ checkNotNull(valueProvider.apply(key));
Review Comment:
yes, I need a variable to store it。 like:
```
V put(long key, V value, int keyHash, boolean onlyIfAbsent,
LongFunction<V> valueProvider) {
V provideValue;
if (value == null) {
provideValue = valueProvider.apply(key);
if (provideValue == null) {
return null;
}
}
```
for the compatibility of the program, I feel that returning null directly is
better than throwing NullPointerException .
what do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]