[Yanel-dev] [Yarep] Sorting of nodes using Node.getNodes()

Michael Wechner michael.wechner at wyona.com
Tue Feb 2 15:46:54 CET 2010


Hi

I have recently noticed that depending on the Filesystem/OS/Java the 
method Node.getNodes() does not sort alphabetically.

On my Mac OS X it does, but on SuSE Linux it does not seem to sort 
alphabetically (but probably rather by last modified).

First of all please be aware of this and to be sure you might want to 
use java.util.Collections#sort(List) or java.util.Collections#sort(List, 
Comparator):

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html

whereas if I will find some time, then I might add some utility methods 
to YarepUtil, e.g.

YarepUtil.sortAlphabetically(Node[] nodes)

or

YarepUtil.sort(Node[] nodes, Comparator)

and also some sample comparators, e.g for sorting by property values, etc.

Cheers

Michi


More information about the Yanel-development mailing list