< 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,807 **** * @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) { 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(); --- 797,807 ---- * @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.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,1221 **** negativePrefix = "'-" + positivePrefix; } } // If no 0s are specified in a non empty pattern, it is invalid ! if (pattern.length() != 0 && zeros.isEmpty()) { throw new IllegalArgumentException("Invalid pattern" + " [" + pattern + "]: all patterns must include digit" + " placement 0s"); } --- 1211,1221 ---- negativePrefix = "'-" + positivePrefix; } } // If no 0s are specified in a non empty pattern, it is invalid ! if (!pattern.isEmpty() && zeros.isEmpty()) { throw new IllegalArgumentException("Invalid pattern" + " [" + pattern + "]: all patterns must include digit" + " placement 0s"); }
< prev index next >