I am using LinkedHashMap in my code.This is my map:
LinkedHashMap<String, Conversation> conversationsMap=new LinkedHashMap<String, Conversation>();
I am adding items to this map with following line:
conversationsMap.put("test",Conversation);
But this line adding item to last.I need to add this item to top of this map.How can I do this ?
LinkedHashMap retains insertion order.To add it to first you need to iterate through older map and insert values in a new map.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With