I'm iterating over below map. I want to compare map values and set and iterate over the map.values that doesn't exist in set
Set<String> articleIds = new Set<String>();
List<object__c> cuList = [SELECT Article_ID__c FROM object__c WHERE Article_ID__c IN: cuWrapperMap.keySet()];
if((cuWrapperMap.keySet().size() > cuList.size()) && cuList.size() > 0){
for(object__c cua : caList){
articleIds.add(cua.Article_ID__c);
for(articleWrapper wrpr : cuWrapperMap.values()){
//Here I want to iterate only for wrpr.articleId's that doesn't exist in the set.
if(!(wrpr.articleId).contains(articleIds)){
object__c cuaRec = new object__c();
cuaRec.Case__c = wrpr.caseId;
cuaRec.Article_ID__c = (wrpr.articleId).substring(0, 15);
createCUAList.add(cuaRec);
}
}
}
}
insert createCUAList;
article_id__c
. see this answer