Merge pull request #992 from Isira-Seneviratne/String_isBlank

Use String.isBlank().
This commit is contained in:
Tobi 2022-11-30 17:48:54 +01:00 committed by GitHub
commit 41c8dce452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 16 deletions

View File

@ -306,23 +306,8 @@ public final class Utils {
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