• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

LinkedList  RSS feed

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i have a list in that list have got files(image files ie image.gif,f_next.jpg) as well as dir(folder iemenu ,box,test..)

0 1 3 4
image.gif f_next.jpg box test

my problem is i want to arrange in a format like dir(folders) first then images.if i go for sorting(say ascending) it has to come in a format like

0-box,1-test,2-f_next,3-image.gif



Regards
Kirba.
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mention a list of files ... are those real File objects? Or something else?

Is this the order you're looking for?

If so you may just be able to throw your File objects in a TreeSet and get them back sorted. If that's not quite what you want - it might be case sensitive - you can write your own Comparator to sort ignoring case.

Does that get you moving in the right direction?
 
kirba devi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,
You have understood wrongly.
List-- is nothing but the LinkedList list=new LinkedList()
In that list having
0-img1(Image reference)
1-dir(some folder)
2-img2(Image reference)
3-dir(some folder)

here in that list i want to sort images separately and dir separately

Regards
Kirba.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!