Java: making list random using List shuffle

A very useful method to randomly order the List:

import java.util.Collections;

List list = fetch();
Collections.shuffle(list);

return list.get(0);

No comments:

Post a Comment