commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <>
Subject Re: [collections] FilenameComparator
Date Thu, 06 Jan 2005 01:38:10 GMT
Interesting, your implementation is a bit more sophisticated, but at 
least it proves that this kind of comparator is a common concern.

Would the Collections folks reconsider their decision and accept such a 
comparator due to "popular" demand ? :) I'm attaching my implementation.

Emmanuel Bourg

Henri Yandell wrote:

> I offered one of those to Collections a while back but it was turned
> down as it chose one specific way to do the ordering:
> For your submission, I think as a comparator of Strings to Collections
> makes the most sense as it deals with java.util.Comparator and Lang
> doesn't.
> Anything in my class is up for grabs if you want any of it :)
> Hen
> On Wed, 05 Jan 2005 01:13:13 +0100, Emmanuel Bourg <> wrote:
>>Hi all, I have developped a File comparator to sort properly the files
>>with a number in the name. For example, instead of sorting with the
>>lexicographic order :
>>foo1.txt < foo10.txt < foo2.txt
>>it compares the numbers when the files share the same prefix and returns
>>this order :
>>foo1.txt < foo2.txt < foo10.txt
>>This is how the "Sort by name" works in the Windows XP file explorer.
>>Since it's quite low level I think it could be included in a commons
>>project, but I'm not sure where:
>>- in [io] as a getComparator() method in FileUtils or as a
>>FilenameComparator class ?
>>- in [lang] as a String comparator ?
>>- nowhere because this was already implemented in another well known
>>project and I wasted my time reinventing the wheel ;)
>>Emmanuel Bourg

View raw message