Is there a way to move an item within a LinkedHashMap
? Specifically, I'd like to move an item to the first position. I know that if I wanted to add an item to the end, I could just do:
LinkedHashMap<String,Integer> items = new LinkedHashMap<String,Integer>();
//...add some items
int i = items.get("removedItem");
items.remove("removedItem");
items.put("removedItem",i);