< prev index next >

src/java.base/unix/classes/java/io/UnixFileSystem.java

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

@@ -96,11 +96,11 @@
         if (prevChar == '/') return normalize(pathname, n, n - 1);
         return pathname;
     }
 
     public int prefixLength(String pathname) {
-        if (pathname.length() == 0) return 0;
+        if (pathname.isEmpty()) return 0;
         return (pathname.charAt(0) == '/') ? 1 : 0;
     }
 
     public String resolve(String parent, String child) {
         if (child.isEmpty()) return parent;

@@ -247,11 +247,11 @@
     public native int getBooleanAttributes0(File f);
 
     public int getBooleanAttributes(File f) {
         int rv = getBooleanAttributes0(f);
         String name = f.getName();
-        boolean hidden = (name.length() > 0) && (name.charAt(0) == '.');
+        boolean hidden = !name.isEmpty() && name.charAt(0) == '.';
         return rv | (hidden ? BA_HIDDEN : 0);
     }
 
     public native boolean checkAccess(File f, int access);
     public native long getLastModifiedTime(File f);
< prev index next >