Equality of attributes of two files

Rajendra Gutupalli Rajendra.Gutupalli at Sun.COM
Sun Jul 20 21:03:50 PDT 2008


Alan Bateman wrote:
>
> In any case, I'm interested to understand the motive for the question. 
> Is this part of a test that checks if the attributes of two files are 
> the same or would you anticipate storing BasicFileAttributes as 
> elements of a collection? If the former, then 
> test/java/nio/file/Path/CopyAndMove.java defines a number of 
> check*Attributes methods that may be useful.
Yes Alan former anticipation is correct, moving a file from one location 
to other location and trying to see if they have same attributes 
prompted me to ask this question.
But I spent some time looking for container objects in Java API's and I 
see most of them have either compredTo or overridden equals, one such 
method I see is 
http://download.java.net/jdk7/docs/api/javax/naming/directory/BasicAttributes.html#equals(java.lang.Object).  

As you said unlike BasicFileAttributes, contents of these objects have 
natural ordering.

I looked at the test case and I follow the same for checking equality.

Thanks
Rajendra.



More information about the nio-dev mailing list