-
Enhancement
-
Resolution: Fixed
-
P5
-
None
-
b03
HashMap <String, Negotiator> cachedMap = getCache();
if (cachedMap != null) {
negotiator = cachedMap.get(getHost());
if (negotiator != null) {
cachedMap.remove(getHost()); // so that it is only used once
}
}
Instead of separate HashMap.get+remove call, we can use single HashMap.remove call and use its return value.
It makes code a bit cleaner and faster.
if (cachedMap != null) {
negotiator = cachedMap.get(getHost());
if (negotiator != null) {
cachedMap.remove(getHost()); // so that it is only used once
}
}
Instead of separate HashMap.get+remove call, we can use single HashMap.remove call and use its return value.
It makes code a bit cleaner and faster.