RFR: 8286366: (cs) Charset.put can use putIfAbsent instead of containsKey+put
Andrey Turbanov
aturbanov at openjdk.java.net
Sun May 15 10:26:43 UTC 2022
On Sun, 8 May 2022 15:11:20 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> It could be changed to use for-each while you are there.
Not sure I get the idea.
Do you mean something like this:
i.forEachRemaining(new Consumer<Charset>() {
@Override
public void accept(Charset cs) {
m.putIfAbsent(cs.name(), cs);
}
});
-------------
PR: https://git.openjdk.java.net/jdk/pull/8480
More information about the nio-dev
mailing list