How to I print information from a map that has the object as the value?
I have created the following map:
Map objectSet = new HashMap<>();
The object has its own class with its own instance variables
I have already populated the above map with data.
I have created a printMap
method, but I can only seem to print the Keys of the map
How to do I get the map to print the values using a for each loop?
So far, I've got:
for (String keys : objectSet.keySet())
{
System.out.println(keys);
}
The above prints out the keys. I want to be able to print out the object variables too.
No comments:
Post a Comment