Skip to content

Commit 9184934

Browse files
committed
Use 'List::isEmpty' instead of checking the list length.
Signed-off-by: Franz Wilhelmstötter <[email protected]>
1 parent 4a370a0 commit 9184934

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

jpx/src/main/java/io/jenetics/jpx/format/LocationFormatter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ static List<String> tokenize(final String pattern) {
915915
switch (c) {
916916
case '\'':
917917
quote = !quote;
918-
if (token.length() > 0) {
918+
if (!token.isEmpty()) {
919919
tokens.add(token.toString());
920920
token.setLength(0);
921921
}
@@ -925,7 +925,7 @@ static List<String> tokenize(final String pattern) {
925925
if (quote) {
926926
token.append(c);
927927
} else {
928-
if (token.length() > 0) {
928+
if (!token.isEmpty()) {
929929
tokens.add(token.toString());
930930
token.setLength(0);
931931
}
@@ -939,7 +939,7 @@ static List<String> tokenize(final String pattern) {
939939
pc != ',' &&
940940
!quote)
941941
{
942-
if (token.length() > 0) {
942+
if (!token.isEmpty()) {
943943
tokens.add(token.toString());
944944
token.setLength(0);
945945
}
@@ -951,7 +951,7 @@ static List<String> tokenize(final String pattern) {
951951
break;
952952
default:
953953
if (PROTECTED_CHARS.contains(pc) || pc == '\'') {
954-
if (token.length() > 0) {
954+
if (!token.isEmpty()) {
955955
tokens.add(token.toString());
956956
token.setLength(0);
957957
}
@@ -963,7 +963,7 @@ static List<String> tokenize(final String pattern) {
963963
pc = c;
964964
}
965965

966-
if (token.length() > 0) {
966+
if (!token.isEmpty()) {
967967
tokens.add(token.toString());
968968
}
969969

0 commit comments

Comments
 (0)