private static void overwriteMembersIfPresent ( List < MemberDefinition > list , List < MemberDefinition > newMembers ) { for ( MemberDefinition newMember : newMembers ) { for ( MemberDefinition member : list ) { if ( member . name . getString ( ) . equals ( newMember . name . getString ( ) ) ) { list . remove ( member ) ; break ; } } list . add ( newMember ) ; } }
Appends a list of new MemberDefinitions to the end of a list and removes any previous MemberDefinition in the list which has the same name as the new member .