8215281: Use String.isEmpty() when applicable in java.base

Reviewed-by: dfuchs, alanb
This commit is contained in:
Claes Redestad 2018-12-13 15:31:05 +01:00
parent c998ead188
commit a3df1d618e
155 changed files with 340 additions and 382 deletions

View file

@ -1113,11 +1113,9 @@ public class DecimalFormat extends NumberFormat {
// Records the need for adding prefix or suffix
fastPathData.positiveAffixesRequired
= (positivePrefix.length() != 0)
|| (positiveSuffix.length() != 0);
= !positivePrefix.isEmpty() || !positiveSuffix.isEmpty();
fastPathData.negativeAffixesRequired
= (negativePrefix.length() != 0)
|| (negativeSuffix.length() != 0);
= !negativePrefix.isEmpty() || !negativeSuffix.isEmpty();
// Creates a cached char container for result, with max possible size.
int maxNbIntegralDigits = 10;
@ -2062,7 +2060,7 @@ public class DecimalFormat extends NumberFormat {
Format.Field signAttribute) {
int start = result.length();
if (string.length() > 0) {
if (!string.isEmpty()) {
result.append(string);
for (int counter = 0, max = positions.length; counter < max;
counter++) {
@ -3042,7 +3040,7 @@ public class DecimalFormat extends NumberFormat {
} else {
string = symbols.getCurrencySymbol();
}
if (string.length() > 0) {
if (!string.isEmpty()) {
if (positions == null) {
positions = new ArrayList<>(2);
}
@ -3613,7 +3611,7 @@ public class DecimalFormat extends NumberFormat {
}
}
if (pattern.length() == 0) {
if (pattern.isEmpty()) {
posPrefixPattern = posSuffixPattern = "";
setMinimumIntegerDigits(0);
setMaximumIntegerDigits(MAXIMUM_INTEGER_DIGITS);