Back
Use LinkedHashMap.
It is precisely like HashMap, except that if you iterate over it, it presents the items in the injection order.
Example:
void foo(Map m) { Map copy = new LinkedHashMap(m); ... }
void foo(Map m) {
Map copy = new LinkedHashMap(m);
...
}
31k questions
32.8k answers
501 comments
693 users