Canonical

File file1 = new File("./filename");
File file2 = new File("filename");

// Filename paths are not equal
boolean b = file1.equals(file2);      // false

// Normalize the paths
try {
    file1 = file1.getFile(); // c:almanac1.4filename
    file2 = file2.getFile(); // c:almanac1.4filename
} catch (IOException e) {
}

// Filename paths are now equal
b = file1.equals(file2);              // true

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.