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 8cca22c commit 0629e1e
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
public class CommaParameterSplitter implements IParameterSplitter {

public List<String> split(String value) {
if ("".equals(value)) {
return Collections.emptyList();
}
return Arrays.asList(value.split(","));
return value.isEmpty() ? Collections.emptyList() : Arrays.asList(value.split(","));
}
}

0 comments on commit 0629e1e

Please sign in to comment.