I have a function prints Map
objects,
public static void printMap(Map<Integer, Integer> map) {
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
System.out.println( entry.getKey() + " " + entry.getValue() );
}
}
Now, I want my function to work with Map<String, Integer>
type of maps too. How to do it? I always wanted to use generics, hope to have a good start with this question.