Archives: List

Java – List Iterate Example


Java – Rotate Elements of List

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]

Java – Convert Array to List

Output:

How many elements you want to add to the array:
red white green

red white green