Paths representing the same file/folder

However, this probably isn't the kind of comparison that we want. It is more meaningful to say that two paths are equal if they are the same file or folder. This can be accomplished via the Files.isSameFile() method. This method acts in two steps:

  1. First, it calls Path.equals(), and, if this method returns true, then the paths are equal and need no further action.
  1. Second, if Path.equals() returns false, then it checks if both paths represent the same file/folder (depending on the implementation, this action may need to open/access both files, so the files must exist in order to avoid an IOException).
//true
boolean path1IsSameFilePath2 = Files.isSameFile(path1, path2);
//true
boolean path1IsSameFilePath3 = Files.isSameFile(path1, path3);
//true
boolean path2IsSameFilePath3 = Files.isSameFile(path2, path3);
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.30.62