Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9308709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:41:37+00:00 2026-06-19T00:41:37+00:00

I would know how to merge two array which contain some duplicate : Here

  • 0

I would know how to merge two array which contain some duplicate :
Here is an exemple to illustrate what I want to do :

// Here is some dictionary which contain an unique "id" key.
NSDictionary *dico1 = [NSDictionary dictionaryWithObjectsAndKeys:
                       @"11111111", @"id", nil];
NSDictionary *dico2 = [NSDictionary dictionaryWithObjectsAndKeys:
                       @"22222222", @"id", nil];
NSDictionary *dico3 = [NSDictionary dictionaryWithObjectsAndKeys:
                       @"33333333", @"id", nil];
NSDictionary *dico4 = [NSDictionary dictionaryWithObjectsAndKeys:
                       @"44444444", @"id", nil];
NSDictionary *dico5 = [NSDictionary dictionaryWithObjectsAndKeys:
                       @"55555555", @"id", nil];

// And here is duplicates of the 2nd and 3td dictionary.
NSDictionary *dico2_bis = [NSDictionary dictionaryWithObjectsAndKeys:
                           @"22222222", @"id", nil];
NSDictionary *dico3_bis = [NSDictionary dictionaryWithObjectsAndKeys:
                           @"33333333", @"id", nil];

And now I have an array which contain some of those dictionaries :

NSArray *currentArray = [NSArray arrayWithObjects:
                         dico1, dico2, dico3, nil];

And here is the new array to be merged with the first one which contain some duplicate and new “data” :

NSArray *tempArray = [NSArray arrayWithObjects:
                      dico2_bis, dico3_bis, dico4, dico5, nil];

My goal, at the final stage, is to have an array which contains all dictionaries with all duplicate deleted

NSArray *finalArray = [NSArray arrayWithObjects:
                       dico1, dico2, dico3, dico4, dico5, nil];

I don’t know how what is the most efficient solution, the merge do have to be fast. Do I have to implement a fast enumeration or a block based enumeration algorithm, or maybe a NSPredicate implementation ?.
I’ve already search about NSPredicate but I’ve not found a way to filter an array with an other array =/
Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:41:38+00:00Added an answer on June 19, 2026 at 12:41 am

    You do not use NSArrays, what you need is a set which automatically eliminates “duplicates” (a “doubloon” is a Spanish gold coin). So you are using simply an NSMutableSet and add your NSDictionaries to it.

    NSMutableSet aSet = [NSMutableSet new];
    [aSet addObject:dico1];
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how to merge these two Javascript ajax scripts. So
Need help to perform merge two similar contact values. I would like to know
I would like to know how difficult it would be to merge the well-designed
i would like know some reference. I know i can googling it. but prefer
What would anyone consider the most efficient way to merge two datasets using Python?
I'd like to merge two arrays with each other: $filtered = array(1 => 'a',
I would like to merge two arrays containing a list of files plus their
I have an XML file and I would like to merge two different CONTACT
I have two MySQL tables and I would like to know if there is
I would like to merge two .caf audio files in my iPhone App? Can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.