From 0629e1e92e6130037d3f3f49d3641952363a61a2 Mon Sep 17 00:00:00 2001 From: Markus KARG Date: Sun, 1 Oct 2023 17:43:32 +0000 Subject: [PATCH] Performance: String.isEmpty() is faster than .equals() --- .../beust/jcommander/converters/CommaParameterSplitter.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/beust/jcommander/converters/CommaParameterSplitter.java b/src/main/java/com/beust/jcommander/converters/CommaParameterSplitter.java index 5487268e1..d5fbfa1c5 100644 --- a/src/main/java/com/beust/jcommander/converters/CommaParameterSplitter.java +++ b/src/main/java/com/beust/jcommander/converters/CommaParameterSplitter.java @@ -7,9 +7,6 @@ public class CommaParameterSplitter implements IParameterSplitter { public List split(String value) { - if ("".equals(value)) { - return Collections.emptyList(); - } - return Arrays.asList(value.split(",")); + return value.isEmpty() ? Collections.emptyList() : Arrays.asList(value.split(",")); } }