src/java.base/share/classes/java/text/AttributedString.java
changeset 53018 8bf9268df0e2
parent 47216 71c04702a3d5
child 57895 82a71d82e326
child 58678 9cf78a70fa4f
--- a/src/java.base/share/classes/java/text/AttributedString.java	Thu Dec 13 16:14:07 2018 +0100
+++ b/src/java.base/share/classes/java/text/AttributedString.java	Thu Dec 13 15:31:05 2018 +0100
@@ -85,7 +85,7 @@
 
             text = buffer.toString();
 
-            if (text.length() > 0) {
+            if (!text.isEmpty()) {
                 // Determine the runs, creating a new run when the attributes
                 // differ.
                 int offset = 0;
@@ -144,7 +144,7 @@
         }
         this.text = text;
 
-        if (text.length() == 0) {
+        if (text.isEmpty()) {
             if (attributes.isEmpty())
                 return;
             throw new IllegalArgumentException("Can't add attribute to 0-length text");