Map<String,Set<String>> st= new Map<String,Set<String>>();
st.put('one',new Set<String>{'1','2'});
 Set<string> ss = new Set<String>();
 ss.addAll(st.values());//Error. I think we should iterate and add to set one by on. any Idea to get all at once (like any addAll..)

any shortcut to get set from map> ? But it return


You have to loop through and use addAll. There is no shortcut.

Set<String> allValues = new Set<String>();
for (Set<String> subset : st.values())
| improve this answer | |

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.