Wednesday, May 21, 2008

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);