There is a HashMap<String,Thread> requests in class sun.net.www.protocol.http.AuthenticationInfo.
Thread t, c;
c = Thread.currentThread();
if ((t = requests.get(key)) == null) {
requests.put (key, c);
assert cached == null;
return cached;
}
if (t == c) {
assert cached == null;
return cached;
}
Instead of separate HashMap.get/put calls we can improve code by HashMap.putIfAbsent.
It results in cleaner and a bit faster code.
Thread t, c;
c = Thread.currentThread();
if ((t = requests.get(key)) == null) {
requests.put (key, c);
assert cached == null;
return cached;
}
if (t == c) {
assert cached == null;
return cached;
}
Instead of separate HashMap.get/put calls we can improve code by HashMap.putIfAbsent.
It results in cleaner and a bit faster code.