< prev index next >

src/java.base/share/classes/javax/security/auth/callback/NameCallback.java

Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb

@@ -60,11 +60,11 @@
      *
      * @exception IllegalArgumentException if {@code prompt} is null
      *                  or if {@code prompt} has a length of 0.
      */
     public NameCallback(String prompt) {
-        if (prompt == null || prompt.length() == 0)
+        if (prompt == null || prompt.isEmpty())
             throw new IllegalArgumentException();
         this.prompt = prompt;
     }
 
     /**

@@ -80,12 +80,12 @@
      *                  if {@code prompt} has a length of 0,
      *                  if {@code defaultName} is null,
      *                  or if {@code defaultName} has a length of 0.
      */
     public NameCallback(String prompt, String defaultName) {
-        if (prompt == null || prompt.length() == 0 ||
-            defaultName == null || defaultName.length() == 0)
+        if (prompt == null || prompt.isEmpty() ||
+            defaultName == null || defaultName.isEmpty())
             throw new IllegalArgumentException();
 
         this.prompt = prompt;
         this.defaultName = defaultName;
     }
< prev index next >