< prev index next >

src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsName.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad

@@ -366,11 +366,11 @@
     }
 
 
     boolean hasRootLabel() {
         return (!isEmpty() &&
-                get(0).equals(""));
+                get(0).isEmpty());
     }
 
     /*
      * Helper method for public comparison methods.  Lexicographically
      * compares components of this name in the range [beg,end) with

@@ -440,11 +440,11 @@
         // If name is neither "." nor "", the octets (zero or more)
         // from the rightmost dot onward are now added as the final
         // label of the name.  Those two are special cases in that for
         // all other domain names, the number of labels is one greater
         // than the number of dot separators.
-        if (!name.equals("") && !name.equals(".")) {
+        if (!name.isEmpty() && !name.equals(".")) {
             add(0, label.toString());
         }
 
         domain = name;          // do this last, since add() sets it to null
     }
< prev index next >