isEmptyOrSpaces accepts CharSequence +review

This commit is contained in:
Vladimir Krivosheev
2014-02-20 14:26:17 +01:00
parent 2610e6c2fa
commit 5febcfeef8
@@ -968,8 +968,14 @@ public class StringUtil extends StringUtilRt {
}
@Contract("null -> true")
public static boolean isEmptyOrSpaces(@Nullable final String s) {
if (s == null || s.isEmpty()) {
// we need to keep this method to preserve backward compatibility
public static boolean isEmptyOrSpaces(@Nullable String s) {
return isEmptyOrSpaces(((CharSequence)s));
}
@Contract("null -> true")
public static boolean isEmptyOrSpaces(@Nullable CharSequence s) {
if (isEmpty(s)) {
return true;
}
for (int i = 0; i < s.length(); i++) {