How to get values from arraylist Hashmap -
how value according comparison. new in android , comparison working fine m not able value displaying in arraylist. below code , log-
for (entry<integer, list<string>> entry : abbre.entryset()) { log.d("abbrevations values- ", entry.getkey() + " " + entry.getvalue()); if(tid.equals(string.valueof(entry.getkey()))){ //string avalue = string.valueof(entry.getvalue()); log.d("abbrkey value: ", string.valueof(entry.getvalue())); } else{ log.d("abbrkey key: ", string.valueof(entry.getkey())); } }
the log -
06-27 11:27:39.375: d/abbrkey tid:(13602): 27 06-27 11:27:39.375: d/abbrevations values-(13602): 23 [8+, 4+, 2-] 06-27 11:27:39.375: d/abbrkey key:(13602): 23 06-27 11:27:39.375: d/abbrevations values-(13602): 27 [8+, 4+, 2-] 06-27 11:27:39.375: d/abbrkey value:(13602): [8+, 4+, 2-] 06-27 11:27:39.375: d/abbrevations values-(13602): 22 [8+, 4+, 2-] 06-27 11:27:39.375: d/abbrkey key:(13602): 22
to values hashmap values(list of string),simply loop , values,so use code
for (entry<integer, list<string>> entry : abbre.entryset()) { log.d("abbrevations values- ", entry.getkey() + " " + entry.getvalue()); if(tid.equals(string.valueof(entry.getkey()))){ //string avalue = string.valueof(entry.getvalue()); log.d("abbrkey value: ", string.valueof(entry.getvalue())); list<string> listvalues = entry.getvalue(); (int = 0; < listvalues.size(); i++){ string firstvalue = listvalues.get(i); // similar values } } else{ log.d("abbrkey key: ", string.valueof(entry.getkey())); } }
Comments
Post a Comment