caojiajun commented on PR #4338:
URL: https://github.com/apache/shenyu/pull/4338#issuecomment-1409779493
add this utils method in MapUtils, and replace the `computeIfAbsent` direct
invoke in project
```
/**
* jdk8 performance bug, see:
https://bugs.openjdk.java.net/browse/JDK-8161372
*
* @param map source map
* @param key key
* @param mappingFunction mappingFunction
* @param <K> k
* @param <V> v
* @return v
*/
public static <K, V> V computeIfAbsent(Map<K, V> map, K key, Function<?
super K, ? extends V> mappingFunction) {
V v = map.get(key);
if (v != null) return v;
return map.computeIfAbsent(key, mappingFunction);
}
```
--
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]