< prev index next >
src/java.base/unix/classes/java/io/UnixFileSystem.java
Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
@@ -94,11 +94,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.equals("")) return parent;
@@ -245,11 +245,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 >