iOS 对比A,B两个数组 找出A比B多出来的元素

    NSMutableArray *dbNsArr = [[NSMutableArray alloc] init];

    NSMutableArray*requestNsArr = [[NSMutableArrayalloc]init];


    for(inti =0; i < dbArr.count; i++) {

        GroupMemberListModel*model = dbArr[i];

        [dbNsArraddObject:model.memberId];

    }


    for(intj =0; j < requestArr.count; j++) {

        GroupMemberListModel*model = requestArr[j];

        [requestNsArraddObject:model.memberId];

    }


    NSMutableSet*dbSet = [NSMutableSetsetWithArray:dbNsArr];

    NSMutableSet*requestSet = [NSMutableSetsetWithArray:requestNsArr];

    [requestSetminusSet:dbSet];

    NSMutableSet*allSet = [NSMutableSetsetWithArray:requestNsArr];

    [dbSetminusSet:allSet];

    [requestSetunionSet:dbSet];


    NSArray*outMemberArr = [requestSetallObjects];

你可能感兴趣的:(iOS 对比A,B两个数组 找出A比B多出来的元素)