Let's say map
has five elements. How can we access the fifth element?
map.get("Give me 5");
map.get(4);
map.get(5);
Perfect! HashMaps are unordered, which means they don't have indices. If we want to access an element, we need to have its key.
Too bad! HashMaps are unordered, which means they don't have indices. If we want to access an element, we need to have its key.