Let's say I have a hashmap as below
Map<String,List<String>> nameMap = new HashMap<String,List<String>>();
Also I already have the following key values in the hashmap
Martin - 1 Julia - 3 Andrew - 2 Steve - 5
Now The question is I have a particular order which I need the hashmap to hold and when I print out the entries in the map it should print in the order I need.
The order I need is
Julia - 3 Andrew - 2 Steve - 5 Martin - 1
I know I can use linked hashmap to preserve the order. but my original one is a Hashmap and how do I arrange it in the order I need?