Use computeIfAbsent in CommandLineArgs.addOptionArg

Signed-off-by: junhyung8795 <junhyung8795@naver.com>
This commit is contained in:
junhyung8795
2026-08-27 17:00:41 +02:00
committed by Brian Clozel
parent d883602919
commit 17e0daf8a1
@@ -46,11 +46,9 @@ class CommandLineArgs {
* without an associated value &mdash; for example, "--foo" vs. "--foo=bar".
*/
public void addOptionArg(String optionName, @Nullable String optionValue) {
if (!this.optionArgs.containsKey(optionName)) {
this.optionArgs.put(optionName, new ArrayList<>());
}
List<String> values = this.optionArgs.computeIfAbsent(optionName, key -> new ArrayList<>());
if (optionValue != null) {
this.optionArgs.get(optionName).add(optionValue);
values.add(optionValue);
}
}