Use String#isEmpty where feasible

This commit replaces checks for empty strings ("".equals(...)) with the
String#isEmpty method.

Closes gh-32377
This commit is contained in:
ali dandach 2024-03-05 15:11:06 +02:00 committed by Sam Brannen
parent 30e75e4a09
commit eb01cc0d9d
3 changed files with 4 additions and 4 deletions

View File

@ -653,14 +653,14 @@ public class EmitUtils {
e.dup();
e.ifnull(skip);
e.swap();
if (delims != null && delims.before != null && !"".equals(delims.before)) {
if (delims != null && delims.before != null && !delims.before.isEmpty()) {
e.push(delims.before);
e.invoke_virtual(Constants.TYPE_STRING_BUFFER, APPEND_STRING);
e.swap();
}
EmitUtils.process_array(e, type, callback);
shrinkStringBuffer(e, 2);
if (delims != null && delims.after != null && !"".equals(delims.after)) {
if (delims != null && delims.after != null && !delims.after.isEmpty()) {
e.push(delims.after);
e.invoke_virtual(Constants.TYPE_STRING_BUFFER, APPEND_STRING);
}

View File

@ -230,7 +230,7 @@ public class TypeUtils {
}
private static String map(String type) {
if (type.equals("")) {
if (type.isEmpty()) {
return type;
}
String t = (String)transforms.get(type);

View File

@ -877,7 +877,7 @@ public abstract class StringUtils {
@SuppressWarnings("deprecation") // for Locale constructors on JDK 19
@Nullable
public static Locale parseLocaleString(String localeString) {
if (localeString.equals("")) {
if (localeString.isEmpty()) {
return null;
}