How to reverse ArrayList in Java?

The reverse method of Collections class can be used to reverse any collection. It is a static method. Let's see the signature of reverse method:

Let's see a simple example to reverse ArrayList in Java:

Output:

Before Reversing
[Mango, Banana, Mango, Apple]
After Reversing
[Apple, Mango, Banana, Mango]





Latest Courses