How do I maintain the insertion order of the HashMap?

Asked 1 years ago, Updated 1 years ago, 141 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.