1Map<String, String> map = new HashMap<>();
2
3for(Entry<String, String> entry:map.entrySet()) {
4 System.out.println("key: "+entry.getKey()+" value: "+entry.getValue());
5}
1//traditional way (long)
2for(map<string,int>::iterator it=m.begin(); it!=m.end(); ++it)
3 if(it->second)cout<<it->first<<" ";
4//easy way(short) just works with c++11 or later versions
5for(auto &x:m)
6 if(x.second)cout<<x.first<<" ";
7//condition is just an example of use