I ahve list of txt filesin 'n directory rolebased071607001038042.txt crf-crf072307001037051.txt crfonlyd073107001037060.txt
The above filenames contain the following (taking the first file as an example): rolebased - This is the rolebasedinformation 071607 - This is the date (mmddyy) 001038042- This is the time including milliseconds(00:10:38:042 AM)
I need to sort these files descendingly according to date and then time (process the oldest files first, and the newest files last).
There are several sorting implementations in the Java library that know everything but how to compare two items. You can provide the comparison logic in a Comparable method on the objects, or in a separate Comparator object. If you're working with String or File objects, you want to make a Comparator.
See Arrays.sort() or TreeSet(comparator). Try to write something using one of these - it should only be a few lines long - and show us what you make!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
This guy is skipping without a rope. At least, that's what this tiny ad said: