Java: how to convert HashMap to array

前端 未结 12 1949
时光取名叫无心
时光取名叫无心 2020-11-29 16:36

I need to convert a HashMap to an array; could anyone show me how it\'s done?

12条回答
  •  野性不改
    2020-11-29 17:07

    An alternative to CrackerJacks suggestion, if you want the HashMap to maintain order you could consider using a LinkedHashMap instead. As far as im aware it's functionality is identical to a HashMap but it is FIFO so it maintains the order in which items were added.

提交回复
热议问题