< prev index next >

src/java.base/share/classes/java/io/Console.java

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

@@ -245,11 +245,11 @@
     */
     public String readLine(String fmt, Object ... args) {
         String line = null;
         synchronized (writeLock) {
             synchronized(readLock) {
-                if (fmt.length() != 0)
+                if (!fmt.isEmpty())
                     pw.format(fmt, args);
                 try {
                     char[] ca = readline(false);
                     if (ca != null)
                         line = new String(ca);

@@ -317,11 +317,11 @@
                 } catch (IOException x) {
                     throw new IOError(x);
                 }
                 IOError ioe = null;
                 try {
-                    if (fmt.length() != 0)
+                    if (!fmt.isEmpty())
                         pw.format(fmt, args);
                     passwd = readline(true);
                 } catch (IOException x) {
                     ioe = new IOError(x);
                 } finally {
< prev index next >