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)

2

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .