iterator map.entry java code example
Example 1: java for map
Map map = new HashMap<>();
for(Entry entry:map.entrySet()) {
System.out.println("key: "+entry.getKey()+" value: "+entry.getValue());
}
Example 2: iterate through map
//traditional way (long)
for(map::iterator it=m.begin(); it!=m.end(); ++it)
if(it->second)cout<first<<" ";
//easy way(short) just works with c++11 or later versions
for(auto &x:m)
if(x.second)cout<