How to Shuffle List in Java Language

Shuffle List in Java

In this example, We will show you about, How to Shuffle List in Java Program. This example was tested and output has been shared in the same post.

ListShuffle.java

Output

Before shuffleing
—————–
[Item 1, Item 2, Item 3, Item 4, Item 5, Item 6, Item 7, Item 8, Item 9, Item 10]

After shuffleing
—————–
[Item 5, Item 1, Item 3, Item 9, Item 7, Item 6, Item 8, Item 10, Item 4, Item 2]

References

1. java.util.Collections API JavaDocs
2. Collections.shuffle() method