How do I maintain the insertion order of the HashMap?

Asked 2 years ago, Updated 2 years ago, 158 views

I'm using HashMap. Whenever I repeat the map, I receive the data in random order even though I put it in sequential order. I need to get it sequentially, what should I do?

java hashmap order

2022-09-22 22:24

1 Answers

LinkedHashMap Try it. It's the same as HashMap, but only sequential. LinkedHashMap retains items in the order of insertion.


2022-09-22 22:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.