Wednesday, July 1, 2009

Sorting list of FIles in Java (returned from listFiles)

Here is some handy code to get files in order...

File[] files = dir.listFiles();
Arrays.sort(files, new Comparator() {
public int compare(File f1, File f2) {
return f1.getName().compareTo(f2.getName());
}
});

2 comments:

peterjohn said...

I appreciate you sharing this article. Really thank you! Much obliged.
This is one awesome blog article. Much thanks again.


sap online training
software online training
sap sd online training
hadoop online training
sap-crm-online-training

peterjohn said...

I really enjoy the blog.Much thanks again. Really Great.
Very informative article post. Really looking forward to read more. Will read on…


oracle online training
sap fico online training
dotnet online training
qa-qtp-software-testing-training-tutorial