Java – Rotate Elements of List

Program to Rotate List Elements in Java

Following example uses rotate() method to rotate elements of the list depending on the 2nd argument of the method.

Output:

List :[one, Two, three, Four, five, six]
rotate: [Four, five, six, one, Two, three]