0

Is there a clean way to take in a hashmap as a function parameter with a specific key type, but any value type?

E.g. I have a few hashmaps with Integer as the key but each uses a different object for the values and I want to create a function they can share. I was thinking something like this but it won't allow me to pass my hashmaps in as they have a more specific value type than Object

public static int getUnusedId(Map<Integer, Object> map){

0 Answers0