File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Reversing an ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Reversing an ArrayList" Watch "Reversing an ArrayList" New topic
Author

Reversing an ArrayList

K Sujit
Ranch Hand

Joined: Mar 23, 2005
Posts: 33
Suppose my arraylist contains objects
ob2, ob3,ob5 and ob1
I want to reverse the order of the objects in the ArrayList.
That is I want it to be
ob1, ob5, ob3 and ob2.

is there any function like(though I didn't find in Javadoc)
arrayListInstance.reverse();


I wish java run in my veins.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42916
    
  68
Try Collections.reverse(arrayList);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reversing an ArrayList