Q:

For loop - First argruement of HashMap

I have a hashmap that takes two arguments, 
private HashMap<Integer, car> carList;

I have successfully written methods that would allow me to put  new values in the HashMap.
Now I was wondering how I can use a for loop or somethign similar to iterate through the first arguement of my Hashmap. I'm trying to list all the cars that have the same int value (price);

A:

The keySet() method will allow you to iterate over the map keys...
for(Integer price: carList.keySet()) {
    // something
}

