Partager via


Files.IsSameFile(IPath, IPath) Method

Definition

Tests if two paths locate the same file.

[Android.Runtime.Register("isSameFile", "(Ljava/nio/file/Path;Ljava/nio/file/Path;)Z", "", ApiSince=26)]
public static bool IsSameFile (Java.Nio.FileNio.IPath? path, Java.Nio.FileNio.IPath? path2);
[<Android.Runtime.Register("isSameFile", "(Ljava/nio/file/Path;Ljava/nio/file/Path;)Z", "", ApiSince=26)>]
static member IsSameFile : Java.Nio.FileNio.IPath * Java.Nio.FileNio.IPath -> bool

Parameters

path
IPath

one path to the file

path2
IPath

the other path

Returns

true if, and only if, the two paths locate the same file

Attributes

Remarks

Tests if two paths locate the same file.

If both Path objects are Path#equals(Object) equal then this method returns true without checking if the file exists. If the two Path objects are associated with different providers then this method returns false. Otherwise, this method checks if both Path objects locate the same file, and depending on the implementation, may require to open or access both files.

If the file system and files remain static, then this method implements an equivalence relation for non-null Paths. <ul> <li>It is reflexive: for Pathf, isSameFile(f,f) should return true. <li>It is symmetric: for two Pathsf and g, isSameFile(f,g) will equal isSameFile(g,f). <li>It is transitive: for three Pathsf, g, and h, if isSameFile(f,g) returns true and isSameFile(g,h) returns true, then isSameFile(f,h) will return return true. </ul>

Java documentation for java.nio.file.Files.isSameFile(java.nio.file.Path, java.nio.file.Path).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to