< prev index next >

src/java.base/share/classes/java/lang/Package.java

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

@@ -395,15 +395,15 @@
      */
     @Override
     public String toString() {
         String spec = versionInfo.specTitle;
         String ver =  versionInfo.specVersion;
-        if (spec != null && spec.length() > 0)
+        if (spec != null && !spec.isEmpty())
             spec = ", " + spec;
         else
             spec = "";
-        if (ver != null && ver.length() > 0)
+        if (ver != null && !ver.isEmpty())
             ver = ", version " + ver;
         else
             ver = "";
         return "package " + packageName() + spec + ver;
     }
< prev index next >