Answers for "iterator of a map iterate in a set"

1

how to iterater map of sets in c++

map<string, set<string>> mp;
     for (auto const& pair : mp) {
         cout << pair.first << ": ";
         for (auto const& elem : pair.second) {
             cout << elem << ", ";
         }
         cout << "\n";
     }
Posted by: Guest on July-30-2021
1

iterate map

Map<String, String> map = ...
for (Map.Entry<String, String> entry : map.entrySet()) {
    System.out.println(entry.getKey() + "/" + entry.getValue());
}
Posted by: Guest on May-19-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language