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 3288468
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:36:40+00:00 2026-05-17T20:36:40+00:00

I am attempting to de-dupe an NSArray of NSDictionaries based on specific keys in

  • 0

I am attempting to de-dupe an NSArray of NSDictionaries based on specific keys in the dictionaries. What I have looks something like this:

NSDictionary *person1 = [NSDictionary dictionaryWithObjectsAndKeys:@"John", @"firstName", @"Smith", "lastName", @"7898", @"employeeID"];
NSDictionary *person2 = [NSDictionary dictionaryWithObjectsAndKeys:@"Eric", @"firstName", @"Johnson", "lastName", @"1718" @"employeeID"];
NSDictionary *person3 = [NSDictionary dictionaryWithObjectsAndKeys:@"John", @"firstName", @"Smith", "lastName", @"1153", @"employeeID"];

NSMutableArray *personArray = [NSArray arrayWithObjects:person1, person2, person3, nil];

// insert some code to de-dupe personArray based SOLELY on the firstName and lastName keys

Notice how there are two employees with the same name but different ID’s. What I would like to do is just get back a new array with only person1 and person2, since person3 has the same data – I just don’t care about the “employeeID” value in this particular problem.

Any ideas? Thanks!

-Matt

  • 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-05-17T20:36:40+00:00Added an answer on May 17, 2026 at 8:36 pm

    Add a Person class which inherits from NSDictionary and implement isEqual: ignoring the ID key, cast your dictionaries to this class, then create an NSSet from your Person objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting something like public string MyText { get {return lbl.Text;} set {lbl.Text = value;}}
I have access to some images that can be gathered like this: http://www.example.com/imageGetter.php?a=0001 If
Attempting to build a C# NPAPI plugin I have found a tutorial which describes
Attempting to get Spring internationalization working. I have used classpath:messages basename, created .properties files
Attempting to use the data series from this example no longer passes the JSONLint
Attempting/struggling to get registration and sign-up working within an active admin project. I have
Attempting to generics-ify some legacy code, I'm stuck. I have a ParentObject which wraps
Attempting to follow this project http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/ When I run it, it says everything installs
Attempting to follow this Java tutorial . About 63 pages in, you are instructed
Attempting to build an interface and generics based graph and getting an odd error

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.