function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dan NorfleetDan Norfleet 

Remove values from List

I have a list of Id's defined as
          Set<ID> ExistingContactIds = new Set<ID>();
With that list, i use as input to build a second list
              list<account_access__c> ListMissingAcctContacts = 
                [SELECT account__c, contact__c,, contact__r.lastname, contact__r.firstname, contact__r.role__c
                FROM account_access__c 
                WHERE isdeleted = FALSE AND contact__r.role__c = 'Owner' AND account__c IN :MissingAcctsIds
                 ORDER BY account__c, contact__r.lastname, contact__r.firstname];

The first list may have 10 separate Id's and the second list may only have data for 7 of those Id's.  What is the easiest way to give me the values Id's from the first list that are NOT in the second list?  

Thanks for any help you can provide.

Best Answer chosen by Dan Norfleet
Steven NsubugaSteven Nsubuga
Something like this should work 
for (account_access__c accountAccess : ListMissingAcctContacts) {