Rotate List Elements in Java


Program to Rotate List Elements in Java

This example shows how to rotate list elements in Java. The rotate method of the Collections class is used to rotate the elements of the list.

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


List :[one, Two, three, Four, five, six]
rotate: [Four, five, six, one, Two, three]
Share This Post On: