< prev index next >

src/java.base/share/classes/sun/security/util/ConsoleCallbackHandler.java

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

@@ -101,11 +101,11 @@
                                 " [" + nc.getDefaultName() + "] ");
                 }
                 System.err.flush();
 
                 String result = readLine();
-                if (result.equals("")) {
+                if (result.isEmpty()) {
                     result = nc.getDefaultName();
                 }
 
                 nc.setName(result);
 

@@ -210,11 +210,11 @@
         String prompt = confirmation.getPrompt();
         if (prompt == null) {
             prompt = "";
         }
         prompt = prefix + prompt;
-        if (!prompt.equals("")) {
+        if (!prompt.isEmpty()) {
             System.err.println(prompt);
         }
 
         for (int i = 0; i < options.length; i++) {
             if (optionType == ConfirmationCallback.UNSPECIFIED_OPTION) {
< prev index next >