As you've asked me to look at this, I've modified the first part of your solution to use maps (your query of List<Address__c> otherAlt was written to return a map) and completed your code to create a map of results for update.
I'm not certain that the map revisions to your existing code will be all that more efficient than what you'd already written, but it's at least easier to read. With that having been said, here's what you've asked for. The other mapping will clearly help you with what you were trying to do.
trigger Addressflag on Address__c (After update, After Insert) { if(Trigger.isUpdate || Trigger.isInsert){ List<ID> ConIds = new List<ID>(); for (Address__c Adds: trigger.new) { ConIds.add(Adds.contact__c); } system.debug('parent con ids'+ConIds); map<Id,contact>conMap = new map([select id, checkbox__c, recordTypeId from contact where Id IN :conIds]); map<Id,Address__c>AddrssMap = new map<Id,Address__c>([select id, contact__c, checkbox__c, contact__r.recordTypeId from Address__c where contact__c in: conIDs]); Map<Id,map<Id,Contact>>ConsForUp = new map<Id,map<Id,Contact>>(); for (Address__c adds: trigger.new) { for(Id aId2: AddrssMap.keyset()) { if ((AddrssMap.get(aId2).contact__c==adds.contact__c) && (aId2 != adds.Id)) { AddrssMap.get(aId2).checkbox__c = FALSE; conMap.get(adds.contact__c).checkbox__c = FALSE if(conMap.get(adds.contact__c).checkbox__c = FALSE){ ConsForUp.put(adds.contact__c,conMap); } } } } //*** Revised update method below *** if(checkrecursive.runOnce()) { list<Contact>toUpdate = new list<Contact>(); for(Id cId : ConsForUp.keyset()) { toUpdate.addAll(ConsForUp.get(cId).values()); // above is a map of id to map, so first we extract the map, then the map's values() // which results in a list of contacts for each map that we add together } update toUpdate; } } }
Note: The above code has not been tested or debugged. Use at your own risk. ;)
Edit in resp to comments
The above trigger queries contacts then puts the results into a map. After you apply the results of your manipulations and perform the update on the results, any BeforeUpdate triggers you have on the Contact object would be expected to execute. They shouldn't execute until after your code in the above trigger has initiated the update (regardless of whether afterInsert or afterUpdate on Address__c).
Once that occurs, any BeforeUpdate triggers on Contact would indeed be expected to execute. See Triggers and Order of Execution in the Apex Developer Guide. Any updates caused by the above trigger must satisfy the requirements of your validation trigger on Contacts. If not, the entire transaction will be rolled back.
If you have multiple triggers on Contact, I recommend you combine them into a single trigger. Until you do, you won't be able to control the order of execution of those triggers. They will execute in a random order each time they're called. If there's any workflow on Contact, your Contact AfterUpdate triggers will be called one additional time.