It looks like I can't either use an ArrayList nor a Set:
Set<>
- I can avoid duplicates using a set, but no shuffle option //Collections.shuffle(List<?> list)
ArrayList<>
- I can use shuffle to randomise the list, but duplicates are allowed.
I could use a Set
and convert this into an ArrayList
(or the other way around) to avoid the duplicates. Alternatively, loop through the set to randomise the items. But I am looking for something more efficient.