list shuffle java

Solutions on MaxInterview for list shuffle java by the best coders in the world

showing results for - "list shuffle java"
Angelo
24 Jan 2018
1import java.util.*;
2
3public class List{
4   
5    public static void main(String[] args){
6        LinkedList<Integer> ListOfNumbers = new LinkedList<Integer>();
7        ListOfNumbers.add(1);
8        ListOfNumbers.add(2);
9        ListOfNumbers.add(3);
10        ListOfNumbers.add(4);
11        ListOfNumbers.add(5);
12        System.out.println("The Original Sequence of numbers was : \n" + ListOfNumbers);
13        Collections.shuffle(ListOfNumbers);
14        System.out.println("\n The shuffled list is : \n" +ListOfNumbers );
15    }
16}
17