< prev index next >
src/java.base/share/classes/java/text/CompactNumberFormat.java
Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD
@@ -797,11 +797,11 @@
* @param positions a list of {@code FieldPostion} in the given
* string
*/
private void append(StringBuffer result, String string,
FieldDelegate delegate, List<FieldPosition> positions) {
- if (string.length() > 0) {
+ if (!string.isEmpty()) {
int start = result.length();
result.append(string);
for (int counter = 0; counter < positions.size(); counter++) {
FieldPosition fp = positions.get(counter);
Format.Field attribute = fp.getFieldAttribute();
@@ -1211,11 +1211,11 @@
negativePrefix = "'-" + positivePrefix;
}
}
// If no 0s are specified in a non empty pattern, it is invalid
- if (pattern.length() != 0 && zeros.isEmpty()) {
+ if (!pattern.isEmpty() && zeros.isEmpty()) {
throw new IllegalArgumentException("Invalid pattern"
+ " [" + pattern + "]: all patterns must include digit"
+ " placement 0s");
}
< prev index next >