Tony Docherty wrote:LinkedHashMap is a Map that preserves insertion order.
Agreed. If I iterate over the map, the values will be printed in insertion order. But my problem is that everytime I have to remove the last element. I can either use the iterator object and keep removing elements whenever I use them or use recursion and keep branching till my initial value = 0.
Is there any other alternative, if not I will one of these two ways to implement it. It would have been great to have a map which has properties similar to queues, i.e. queue.poll(), which will do the work which I want.