I need to implement a structure in Java that is a key-value list (of types Integer-String) and I want to shuffle it.
Basically, I would like to do something like that.>
You could keep a separate List of the keyvalues, shuffle that and use it to access the HashMap.
List
HashMap
List keys = new ArrayList(map.keySet()); Collections.shuffle(keys); for(Integer i : keys) map.get(i); // Gets the values in the shuffled order