Use String::isEmpty instead of "".equals(arg) when arg is not null
This commit is contained in:
committed by
Juergen Hoeller
parent
4883b8aa03
commit
7dba79c7c1
@@ -49,7 +49,7 @@ final class StringToBooleanConverter implements Converter<String, Boolean> {
|
||||
@Override
|
||||
public Boolean convert(String source) {
|
||||
String value = source.trim();
|
||||
if ("".equals(value)) {
|
||||
if (value.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
value = value.toLowerCase();
|
||||
|
||||
@@ -571,8 +571,8 @@ public class AntPathMatcher implements PathMatcher {
|
||||
int dotPos2 = pattern2.indexOf('.');
|
||||
String file2 = (dotPos2 == -1 ? pattern2 : pattern2.substring(0, dotPos2));
|
||||
String ext2 = (dotPos2 == -1 ? "" : pattern2.substring(dotPos2));
|
||||
boolean ext1All = (ext1.equals(".*") || ext1.equals(""));
|
||||
boolean ext2All = (ext2.equals(".*") || ext2.equals(""));
|
||||
boolean ext1All = (ext1.equals(".*") || ext1.isEmpty());
|
||||
boolean ext2All = (ext2.equals(".*") || ext2.isEmpty());
|
||||
if (!ext1All && !ext2All) {
|
||||
throw new IllegalArgumentException("Cannot combine patterns: " + pattern1 + " vs " + pattern2);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class PatternMatchUtils {
|
||||
return str.endsWith(pattern.substring(1));
|
||||
}
|
||||
String part = pattern.substring(1, nextIndex);
|
||||
if ("".equals(part)) {
|
||||
if (part.isEmpty()) {
|
||||
return simpleMatch(pattern.substring(nextIndex), str);
|
||||
}
|
||||
int partIndex = str.indexOf(part);
|
||||
|
||||
@@ -821,7 +821,7 @@ public abstract class StringUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if ("".equals(variant) && country.startsWith("#")) {
|
||||
if (variant.isEmpty() && country.startsWith("#")) {
|
||||
variant = country;
|
||||
country = "";
|
||||
}
|
||||
@@ -1192,7 +1192,7 @@ public abstract class StringUtils {
|
||||
}
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
if ("".equals(delimiter)) {
|
||||
if (delimiter.isEmpty()) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
result.add(deleteAny(str.substring(i, i + 1), charsToDelete));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user