< prev index next >

src/java.base/share/classes/java/text/AttributedString.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD

*** 83,93 **** appendContents(buffer, iterators[counter]); } text = buffer.toString(); ! if (text.length() > 0) { // Determine the runs, creating a new run when the attributes // differ. int offset = 0; Map<Attribute,Object> last = null; --- 83,93 ---- appendContents(buffer, iterators[counter]); } text = buffer.toString(); ! if (!text.isEmpty()) { // Determine the runs, creating a new run when the attributes // differ. int offset = 0; Map<Attribute,Object> last = null;
*** 142,152 **** if (text == null || attributes == null) { throw new NullPointerException(); } this.text = text; ! if (text.length() == 0) { if (attributes.isEmpty()) return; throw new IllegalArgumentException("Can't add attribute to 0-length text"); } --- 142,152 ---- if (text == null || attributes == null) { throw new NullPointerException(); } this.text = text; ! if (text.isEmpty()) { if (attributes.isEmpty()) return; throw new IllegalArgumentException("Can't add attribute to 0-length text"); }
< prev index next >