In Eclipse, what is the most efficient way to determine whether two IPaths point to the same resource?
In Eclipse, what is the most efficient way to determine whether two IPath s
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you deal with local files, the simpliest way is to use method toFile() of IPath interface and then check the equality of files. This worked for me, and seems to be efficient enough.
But if you also have to take into account UNC pathes (i.e. //Server/Volume:/path), this would be a bit more difficult and there are open questuions. Assume, two pathes //Server/Volume:/path and //X.X.X.X/Volume/path (where X.X.X.X is IP-address of the Server). Do you need to treat them as equal?
In any case, you should write your own comparison function, which compares the result of segments() method and then does anything you want with getDevice().