I have the following structure:
HashMap< String, HashMap< String, String>>
Now i want to know the last accessed element in the 2nd dimension.
I know there is TreeMap which makes sense in the 1rst dimension but after that it doesn’t make any sense.
How can I keep track of a 2D HashMap ordering?
With access i mean:
value = hashmap.get("a").get("1")
value = hashmap.get("b").get("2")
value = hashmap.get("c").get("3")
hashmap.removeLast();
hashmap.removeLast();
hashmap.removeLast();
there is no native way to do what you want. But you can extends HashMap, override the get to store the key of the get in a list, and then add a method like removeLastGetElemet(), that just get the last element of the list and call a remove(key)