In this program I want to display (textview) as Banana as the key value is. And I want to remove that key value 2 which holds banana. and i want to display (textview2) as Orange .Is there any alterative there? Could u give me a solution to obtain this? Thanks in advance
int a = 1;
int b = 2;
int c = 3;
int d = 2;
Hashtable<Integer, String> my_dict = new Hashtable <Integer, String>();
my_dict.put(a, "Apple");
my_dict.put(b, "Banana");
my_dict.put(c, "Orange");
my_dict.put(d, "Grapes");
textView.setText(my_dict.get(1));//displays Apple
my_dict.remove(1);//removes Apple
textView2.setText(my_dict.get(2));//displays Grapes
my_dict.remove(2);//removes Grapes
textView3.setText(my_dict.get(2));//displays Banana
my_dict.remove(2);//removes Banana
But i dont want to alter that duplicate keys. I want to iterate through each values of key and i want to get that datas which is stored in that key ...and i want to delete that key and value ...and after i want to check for another. (In this case)