Using the java collection we can rotate or move the elements of the list.
1 2 3 4 5 6 7 8 9 10 | import java.util.*; public class Main { public static void main(String[] args) { List list = Arrays.asList( "This is the statement you want to rotate in different phrases" .split( " " )); System.out.println( "List :" +list); Collections.rotate(list, 3 ); System.out.println( "rotate: " + list); } } |