In this section, you will learn about shuffling the element of a list or array.In this section, you will learn about shuffling the element of a list or array.
Shuffling is the technique i.e. used to randomize the list or array to prepare each and every element for the operation. In this section, you will learn about shuffling the element of a list or array. Shuffling the element means moving the element from one place to another place randomly.
In the given program, list is created which contains some values. List lists the elements of the Collection. This program takes some values for the list and it sorts these values after shuffling. For this purposes some methods and APIs are explained below which have been used in the program:
This is the class of java.util.*; package which extends Collection. This is used to list elements available in the Collections. In this program a argument <Integer> has been passed with the List for type checking.
This is the construction of ArrayList class of the java.util.*; package that extends the AbstractList class. It constructs an empty list. You can specify the capacity of the list by passing a value to the constructor.
This is the method of the Collections class which is used to sort the list elements in the default order.
Here is the code of program: