src/java.base/windows/classes/sun/nio/fs/WindowsPath.java
changeset 53018 8bf9268df0e2
parent 47216 71c04702a3d5
--- a/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java	Thu Dec 13 16:14:07 2018 +0100
+++ b/src/java.base/windows/classes/sun/nio/fs/WindowsPath.java	Thu Dec 13 15:31:05 2018 +0100
@@ -243,7 +243,7 @@
             // relative to default directory
             String remaining = path.substring(root.length());
             String defaultDirectory = getFileSystem().defaultDirectory();
-            if (remaining.length() == 0) {
+            if (remaining.isEmpty()) {
                 return defaultDirectory;
             } else if (defaultDirectory.endsWith("\\")) {
                  return defaultDirectory + remaining;
@@ -299,7 +299,7 @@
     // -- Path operations --
 
     private boolean isEmpty() {
-        return path.length() == 0;
+        return path.isEmpty();
     }
 
     private WindowsPath emptyPath() {
@@ -340,7 +340,7 @@
 
     @Override
     public WindowsPath getRoot() {
-        if (root.length() == 0)
+        if (root.isEmpty())
             return null;
         return new WindowsPath(getFileSystem(), type, root, root);
     }
@@ -556,7 +556,7 @@
 
         // corner case - all names removed
         if (remaining == 0) {
-            return (root.length() == 0) ? emptyPath() : getRoot();
+            return root.isEmpty() ? emptyPath() : getRoot();
         }
 
         // re-constitute the path from the remaining names.