Hi
How do you return a key that relates to a value?
I have a hashmap - Map <String,ArrayList<Integer>>
which I wish to write a method for that scans through the ArrayList<Integer> and returns the key of a given is within the ArrayList
thanks
Printable View
Hi
How do you return a key that relates to a value?
I have a hashmap - Map <String,ArrayList<Integer>>
which I wish to write a method for that scans through the ArrayList<Integer> and returns the key of a given is within the ArrayList
thanks
You don't. There is no guaranteed one-to-one correspondence between value and key (as opposed to the other way around).
This post is not clear to me at all. What exactly are you trying to do again? What code do you have?Quote:
I have a hashmap - Map <String,ArrayList<Integer>>
which I wish to write a method for that scans through the ArrayList<Integer> and returns the key of a given is within the ArrayList