java - How to get key from map using list as a value -


i making tags using java collections. made map using list value.

can key searching words list? how can that?

map<string, list<string>> map = new hashmap<string, list<string>>();     list<string> list1 = new arraylist<string>(); list<string> list2 = new arraylist<string>();  list1.add("mammal"); list1.add("cute");  list2.add("mammal"); list2.add("big");  map.put("cat", list1); map.put("dog", list2); 

if understand correctly, want obtain key given 1 of value in list stored corresponding value? of course, can these lists using values() method of map interface , iterate on those. however, how having second map use tags keys , store list of entries carrying tag? large data sets, perform better.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -