When you need both the key and the value it's recommended to iterate the map using the entry set.