0

Below is my map. Looking for shortest way to get everything into list.

Map<String,List<User>> permSetNameUserMap;
List<user> userList = permSetNameUserMap.Values(); //This is wrong becoz its list<List<user>>

Any Idea to store into userList fastest way ? (possible of not using loop)

4

You have to loop through the map:

List<User> userList = new List<User>();
for (String key : permSetNameUserMap.keySet()){
    userList.addAll(permSetNameUserMap.get(key));
}

and use addAll for each list value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.