How to select a random key from a HashMap in Java?

前端 未结 9 1225
小鲜肉
小鲜肉 2021-02-05 05:03

I\'m working with a large ArrayList>, and I would repeatedly need to select a random key from a random HashMap (and do some stuff with it).

9条回答
  •  無奈伤痛
    2021-02-05 05:56

    Sounds like you should consider either an ancillary List of keys or a real object, not a Map, to store in your list.

提交回复
热议问题