java - Modifying value in Hashtable -
hello come problem modifying value in hashtable when 2 keys equal.
i define hashtable,
hashtable<string, integer> hash = new hashtable<string, integer>();
and program fills data .put()
method.
note: first column represents hex values
08 86 aa 10 ff 330 2a 54 e1 60
i can check string duplicates if(hash.containskey(string x)){}
. if want insert data in hashtable, same string hash.put("aa", 77);
dont know how add value in hashtable new value , have hashtable no duplikate strings. means have final hastable looking likewise
08 86 aa 87 ff 330 2a 54 e1 60
any suggestions?
string yourkey = "aa"; int val = 77; if (hashtable.containskey(yourkey)) val += hashtable.get(yourkey)); hashtable.put(yourkey, val);
this checks duplicates , if there is, add original value table
Comments
Post a Comment