boolean (FilePath path1, FilePath path2) { if (path1 == path2) return true; if (path1 == null || path2 == null) return false; if (path1.isDirectory() != path2.isDirectory()) return false; String canonical1 = path1.getPath(); String canonical2 = path2.getPath(); return canonical1.equals(canonical2); }