private static Map<String, List<ProviderInfo>> convertToMap(List<ProviderGroup> providerGroups) {
        Map<String, List<ProviderInfo>> map = new HashMap<String, List<ProviderInfo>>(providerGroups.size());
        for (ProviderGroup providerGroup : providerGroups) {
            List<ProviderInfo> ps = map.get(providerGroup.getName());
            if (ps == null) {
                ps = new ArrayList<ProviderInfo>();
                map.put(providerGroup.getName(), ps);
            }
            ps.addAll(providerGroup.getProviderInfos());
        }
        return map;
    }
Compare two provider group list, return add list and remove list

@param oldGroups old provider group list
@param newGroups new provider group list
@param add       provider list need add
@param remove    provider list need remove
core/api/src/main/java/com/alipay/sofa/rpc/client/ProviderHelper.java