posted 21 years ago
hi david,
i agree we can use Comparator and sort() for achieving this but we need to have compare() method having the appropriate algorithm.
here is the example i tried,
input file "orderby.txt" is as follows,
---------------------
vasavada , Maulin , H
vasavada , Niragi , H
Vasavada , Niragi , H
Mehta , Soham , R
Mehta , Soham , J
---------------------
output is,
---------------------
Data before sorting
vasavada,Maulin,H
vasavada,Niragi,H
Vasavada,Niragi,H
Mehta,Soham,R
Mehta,Soham,J
***************************************
Data after sorting
Mehta,Soham,J
Mehta,Soham,R
Vasavada,Niragi,H
vasavada,Maulin,H
vasavada,Niragi,H
Hope this helps.
maulin
---------------------