File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Reversing an ArrayList" Watch "Reversing an ArrayList" New topic

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)

I wish java run in my veins.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39547
Try Collections.reverse(arrayList);

Ping & DNS - updated with new look and Ping home screen widget
subject: Reversing an ArrayList
Similar Threads
about gc()
Simple Tag with Attribute
Using Objects as Parameters
Trees in Java