Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsShuffleExample2 { public static void main(String[] args) { //Create linked list object LinkedList
list = new LinkedList
(); //Add values in the list list.add(10); list.add(-20); list.add(50); list.add(90); list.add(-15); System.out.println("List before Shuffle : "+list); Collections.shuffle(list); System.out.println("List after shuffle : "+list); } }
Output