I have created a hashtable in java as: Hashtable<Integer, String> h = new Hashtable<Integer, String>();
Now I have populated some values in this Hashtable as:
1 -> "A"
2 -> "B"
3 -> "C"
4 -> "D"
Now I want to check if a particular key is present in the hashtable. If it is indeed present then I will modify the value part of the HashTable for that particular key. For e.g. I want to check if the key = 2 is present or not. Since it is present I want to modify the value part with 'F'.
So now the entry will look like: 2 -> "B F".
So the Hashtable will become as:
1 -> "A"
2 -> "B F"
3 -> "C"
4 -> "D"
Can someone please suggest me the code to this problem in java.
Many thanks in advance.