Skip to content

Commit

Permalink
Merge pull request #992 from Isira-Seneviratne/String_isBlank
Browse files Browse the repository at this point in the history
Use String.isBlank().
  • Loading branch information
TobiGr authored Nov 30, 2022
2 parents a1128ec + 2bca56f commit 41c8dce
Showing 1 changed file with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,23 +306,8 @@ public static <K, V> boolean isNullOrEmpty(final Map<K, V> map) {
return map == null || map.isEmpty();
}

public static boolean isWhitespace(final int c) {
return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r';
}

public static boolean isBlank(final String string) {
if (isNullOrEmpty(string)) {
return true;
}

final int length = string.length();
for (int i = 0; i < length; i++) {
if (!isWhitespace(string.codePointAt(i))) {
return false;
}
}

return true;
return string == null || string.isBlank();
}

@Nonnull
Expand Down

0 comments on commit 41c8dce

Please sign in to comment.