mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
This commit is contained in:
parent
c998ead188
commit
a3df1d618e
155 changed files with 340 additions and 382 deletions
|
@ -372,7 +372,7 @@ public abstract class ZoneId implements Serializable {
|
|||
public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
|
||||
Objects.requireNonNull(prefix, "prefix");
|
||||
Objects.requireNonNull(offset, "offset");
|
||||
if (prefix.length() == 0) {
|
||||
if (prefix.isEmpty()) {
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -1439,7 +1439,7 @@ public final class DateTimeFormatterBuilder {
|
|||
*/
|
||||
public DateTimeFormatterBuilder appendLiteral(String literal) {
|
||||
Objects.requireNonNull(literal, "literal");
|
||||
if (literal.length() > 0) {
|
||||
if (!literal.isEmpty()) {
|
||||
if (literal.length() == 1) {
|
||||
appendInternal(new CharLiteralPrinterParser(literal.charAt(0)));
|
||||
} else {
|
||||
|
@ -1832,7 +1832,7 @@ public final class DateTimeFormatterBuilder {
|
|||
throw new IllegalArgumentException("Pattern ends with an incomplete string literal: " + pattern);
|
||||
}
|
||||
String str = pattern.substring(start + 1, pos);
|
||||
if (str.length() == 0) {
|
||||
if (str.isEmpty()) {
|
||||
appendLiteral('\'');
|
||||
} else {
|
||||
appendLiteral(str.replace("''", "'"));
|
||||
|
@ -4332,7 +4332,7 @@ public final class DateTimeFormatterBuilder {
|
|||
this.key = k;
|
||||
this.value = v;
|
||||
this.child = child;
|
||||
if (k.length() == 0){
|
||||
if (k.isEmpty()) {
|
||||
c0 = 0xffff;
|
||||
} else {
|
||||
c0 = key.charAt(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue