mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8286366: (cs) Charset.put can use putIfAbsent instead of containsKey+put
Reviewed-by: alanb
This commit is contained in:
parent
9becf7d578
commit
6b9c15211e
1 changed files with 1 additions and 2 deletions
|
@ -576,8 +576,7 @@ public abstract class Charset
|
||||||
private static void put(Iterator<Charset> i, Map<String,Charset> m) {
|
private static void put(Iterator<Charset> i, Map<String,Charset> m) {
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
Charset cs = i.next();
|
Charset cs = i.next();
|
||||||
if (!m.containsKey(cs.name()))
|
m.putIfAbsent(cs.name(), cs);
|
||||||
m.put(cs.name(), cs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue