Q:

Illegal assignment from List> to Set

I have two maps like below:
Map<String,Set<Id>> emailMatchingContacts = new Map<String,Set<Id>>();
Map<String,Set<Id>> epostMatchingContacts = new Map<String,Set<Id>>();

I've loaded some keys and values to the maps. Now I'm trying to get all the contact id's added in this maps. Tried with minimum possible code like below
Set<Id> matchingContactIds = new Set<Id>();
matchingContactIds.addAll(emailMatchingContacts.values());
matchingContactIds.addAll(epostMatchingContacts.values());

but it was throwing an error like below
Illegal assignment from List<Set<Id>> to Set<Id>

Is that apex standard behavior, loading the map values into List by default?

A:

emailMatchingContacts.values() will return List of the values of Map from key-value pairs. That will be List<Set<Id>>
This will be resolved by either 1 of them:

emailMatchingContacts should be of type Map<String,Id> OR . 
you should do matchingContactIds.addAll(emailMatchingContacts.get(key))

emailMatchingContacts.get(key) will return Set<Id> from a given item which has key as key. PFB:
for(String key : emailMatchingContacts.keySet()) {
    matchingContactIds.addAll(emailMatchingContacts.get(key));
}

