how to get a set from a map in java 1

how to get a set from a map in java

Collection theValues = map.values();

Here is what the above code is Doing:
1. Create a HashMap object called map.
2. Add some key/value pairs to the map.
3. Get the keys from the map and put them in a Set object called theKeys.
4. Get the values from the map and put them in a Collection object called theValues.

Similar Posts