Java Collections reverse() MethodThe reverse() method of Java Collections class is used to reverse the order of the elements in the specified list. SyntaxFollowing is the declaration of reverse() method: Parameter
ReturnsThe reverse() method does not return anything. ExceptionsNA Compatibility VersionJava 1.2 and above Example 1Test it NowOutput: Original List:- [Java, PHP, Python, COBOL] Modified List:- [COBOL, Python, PHP, Java] Example 2Test it NowOutput: Original List:- [1, 2, 3, 4] Modified List:- [4, 3, 2, 1] Example 3Test it NowOutput: Original Array : [10, -20, 30, -40, 50] Modified Array : [50, -40, 30, -20, 10] Next TopicJava Collections Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India