Shuffle collection or elements in arrays

xiaoxiao2021-03-06  15

You can use collections.shuffle () to raise the order of elements.

/ / Create a list

List list = new arraylist ();

/ / Add elements to LIST

// shuffle List elements

Collects.shuffle (list);

// Create an Array

String [] array = new string [] {"a", "b", "c"};

// shuffle array elements

Collections.shuffle (Arrays.aslist (array);

转载请注明原文地址:https://www.9cbs.com/read-46021.html

New Post(0)