java - Something like Collections.rotate for map -


not looking code yet, advice.

i'm devising scheduler takes text file input , schedules weekly games teams. have working, , i'm looking @ expanding hold results. @ moment read teams list. , use collections.rotate rotate list in order randomize fixtures.

i thinking of using map hold team , number of wins, rotate doesn't appear work map. there similar function i'm missing, or have overlooked?

you wouldn't want rotate map itself, sounds want rotate view of map's keys.

so in pseudo-code, like

//make copy of keys of map list keys = new arraylist(yourmap.keys()) collections.rotate(keys) //iterate on keys of map in new rotated order key in keys:     object value = yourmap.get(key)     // value 

Comments