Get the first item of linkedhashmap
collections, java, linkedhashmap
Solution
You can use this to get the first element key:
Object key = linkedHashMap.keySet().iterator().next();
then to get the value:
Object value = linkedHashMap.get(key);
and finally to remove that entry:
linkedHashMap.remove(key);
Problem
I am using `LinkedHashMap`. I will always process the first value and that can be deleted (if possible) so that during the next iteration I will again take the same first value from the map to process. What can I use to get the first value.