java - How to iterate on hashmap that have k,v of string and list? -


i have hashmap this:

hashmap<string, list<string>> total=new hashmap<>(); 

and have hashmap k,v , want iterate , print each key key values have including duplicates, , each duplicate print key again, this:

123   john  123   tom  123   jack  234   terry  234   jeniffer  345   jacob  555   sara 

for (map.entry<string, list<string>> entry : total.entryset()) {   (string s : entry.getvalue()) {     system.out.println(entry.getkey() + " " + s);   } } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -