From 8887053ad1d832ec9b2a8a50cb7f3c9ddd516a82 Mon Sep 17 00:00:00 2001 From: Markus KARG Date: Sun, 1 Oct 2023 17:50:22 +0000 Subject: [PATCH] Performance: String.isEmpty() is faster than .equals() --- src/main/java/com/beust/jcommander/JCommander.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/beust/jcommander/JCommander.java b/src/main/java/com/beust/jcommander/JCommander.java index d4cb853a..12a50d01 100644 --- a/src/main/java/com/beust/jcommander/JCommander.java +++ b/src/main/java/com/beust/jcommander/JCommander.java @@ -587,7 +587,7 @@ private List readFile(String fileName) { // Read through file one line at time. Print line # and line while ((line = bufRead.readLine()) != null) { // Allow empty lines and # comments in these at files - if (line.length() > 0 && !line.trim().startsWith("#")) { + if (!line.isEmpty() && !line.trim().startsWith("#")) { result.addAll(Arrays.asList(line.split("\\s"))); } }