Skip to content

Commit

Permalink
Performance: String.isEmpty() is faster than .equals()
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Oct 1, 2023
1 parent 0629e1e commit 8887053
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/beust/jcommander/JCommander.java
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ private List<String> 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")));
}
}
Expand Down

0 comments on commit 8887053

Please sign in to comment.