aspose 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
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: 42292
    
  64
Try Collections.reverse(arrayList);


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reversing an ArrayList