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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:38:31+00:00 2026-05-25T13:38:31+00:00

I am revolving around with a small issue in iPhone while playing around Array

  • 0

I am revolving around with a small issue in iPhone while playing around Array and Dictionary. I have and product dictionary with the following data

  name = Product;
    options =     (
                {
            code = code1;
            name = "product AAA";
        },
                {
            code = code1;
            name = "product BBB";
        },
                {
            code = "code2";
            name = "product BBB";
        },
                {
            code = "code3";
            name = "product CCC";
        },
                {
            code = "code3";
            name = "product DDD";
        },
                {
            code = code4;
            name = "product EEE";
        },
                {
            code = code4;
            name = "product FFF";
        }
    );

Also i have an array of matching products

matchingProducts
{
    "product BBB",
    "product CCC",
    "product DDD"
)

Now, all i want to do is i want to remove from products dictionary comparing to matchingProducts array. how can i do it.
Note: I cannot use key to remove objects as per my business rules. I have issue as i have names are repeated but i have to get the final result dictionary as shown below. Is it possible.

   name = Product;
    options =     (
                {
            code = code1;
            name = "product AAA";
        },
                {
            code = code1;
            name = "product BBB";
        },
                {
            code = code4;
            name = "product EEE";
        },
                {
            code = code4;
            name = "product FFF";
        }
    );

Please, reply me back if my question is not clear.

I have fixed the similar issue in java using the below code

for (int j = 0; j < matchingProducts.size(); j++) {
 String product = ((Product) matchingProducts.elementAt(i)).name;

 for (int i = 0; i <Product.size(); i++) {
     String productName = ((Product) Product.elementAt(i)).name;
     if (product.equals(productName)) {
  Product.removeElementAt(i);
  break;
     }
 }
 }
  • 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-25T13:38:31+00:00Added an answer on May 25, 2026 at 1:38 pm
    NSMutableDictionary *Product = initialize like you did with Products;
    NSMutableDictionary *resultant = [NSMutableDictionary alloc]init]; //this will have your result    
    NSArray *keys = [Product allKeys];
    for(int i = 0 ; i < [keys count]; i++)
      {
        id temp = [Product objectForKey:keys[i]];
    
     bool matchFound = NO;
    for (int j = 0; j < [matchingProduct count]; j++)
       {
         id temptemp = [matchingProduct objectAtIndex:j] //Assuming matchingProduct is an NSArray or NSMutableArray
         if(temp == temptemp)
           {
               matchFound = YES;
           }
       }
    
      if(!matchFound)
         [resultant addObject:temp];     
    

    }

    // resultant now has what you wanted. Use it.

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

Sidebar

Related Questions

Have seen some conversations revolving around this, but hoping for some current input as
I was given the following struct definitions for an assignment revolving around queues and
I currently maintain 3 websites all revolving around the same concept. 2 of them
I am rendering a scene in which I have two spheres. I am revolving
Let's assume the following: I have an IIS web site set up IIS is
I have a code like A = B|C|D|E; Throwing the warning suggest parentheses around
I have a project with mixed Java and Scala sources, following the instructions on
I feel like this is going to be a simple answer revolving around AutoResizingMasks,
I've been exploring WPF and XAML for a while now, but have hit a
I have started refactoring a small application to use a small DI container instead

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.