dcsimg
Kindly loook into this problem
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Amaresh_Dhal
Posted On:   Wednesday, July 7, 2004 05:26 AM


I have two arraylists named a1 and a2.


a1 contains the name of the files.

a1=[a,b,c,d]

a2 contains dates correspond to those filenames.

a2=[12/01/2005,01/01/2001,23/09/2003,19/12/1999]


now I want to sort it wrt date so that filename and date

sequence should not change.


kindly mail :: amaresh_dhal@yahoo.com

Re: Kindly loook into this problem

Posted By:   Srikanth_B  
Posted On:   Wednesday, July 7, 2004 08:41 PM



I think a hashmap/hashtable would be an appropriate solution for this if two filenames can't be same.




I don't understand why you did choose Arraylist for this purpose ???




:-?

Re: Kindly loook into this problem

Posted By:   Simon_Ablett  
Posted On:   Wednesday, July 7, 2004 05:46 AM

Create a wrapper object containing both a date and a filename and then insert instances of this object into the collection. Then when you sort the collection the associations will be retained.

Regards.
About | Sitemap | Contact