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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:59:01+00:00 2026-05-26T21:59:01+00:00

I little confuse in NSMutableDictionary retrieving Key and Value checking for that i did

  • 0

I little confuse in NSMutableDictionary retrieving Key and Value checking for that i did this code.

    NSMutableDictionary *testDictionary=[NSMutableDictionary dictionary];
        //  NSMutableDictionary *testDictionary=[[NSMutableDictionary alloc]init];

        [testDictionary setObject:@"Muhammed Musthafa" forKey:@"10005"];
        [testDictionary setObject:@"Lubaba p" forKey:@"10006"];
        [testDictionary setObject:@"Sahala Banu" forKey:@"10007"];
        [testDictionary setObject:@"Vishnu k" forKey:@"10008"];
        [testDictionary setObject:@"Shabeer PP" forKey:@"10009"];
        [testDictionary setObject:@"Sabeehath " forKey:@"10010"];
        [testDictionary setObject:@"Anusha GS" forKey:@"10011"];
        [testDictionary setObject:@"JINI KS" forKey:@"10012"];
        [testDictionary setObject:@"Athulya T" forKey:@"10013"];
        [testDictionary setObject:@"Midhun KS" forKey:@"10014"];

        for(NSString *kk in testDictionary)
        {
            NSString *fName;
            if(kk==@"10006")
            {
                fName=[testDictionary objectForKey:kk];

            }
            if(kk==@"10007")
            {
                fName=[testDictionary objectForKey:kk];

            }
            if(kk==@"10013")
            {
                fName=[testDictionary objectForKey:kk];
            }
            NSLog(@"KEY=====%@ and  Value====%@",kk,fName);

        }
The out put value :

    2011-11-17 10:49:37.054 ArchiveData[2539:207] KEY=====10013 and  Value====
    2011-11-17 10:49:37.055 ArchiveData[2539:207] KEY=====10006 and  Value====
    2011-11-17 10:49:37.056 ArchiveData[2539:207] KEY=====10008 and  Value====
    2011-11-17 10:49:37.056 ArchiveData[2539:207] KEY=====10010 and  Value====
    2011-11-17 10:49:37.057 ArchiveData[2539:207] KEY=====10012 and  Value====
    2011-11-17 10:49:37.057 ArchiveData[2539:207] KEY=====10014 and  Value====
    2011-11-17 10:49:37.058 ArchiveData[2539:207] KEY=====10005 and  Value====
    2011-11-17 10:49:37.059 ArchiveData[2539:207] KEY=====10007 and  Value====
    2011-11-17 10:49:37.060 ArchiveData[2539:207] KEY=====10009 and  Value====
    2011-11-17 10:49:37.061 ArchiveData[2539:207] KEY=====10011 and  Value====
  1. why this three {(kk==@”10006″) if(kk==@”10007″) if(kk==@”10013″)} if state ment return false?

  2. There is any other method for checking id key like this?

  3. I saw the same type of coding working fine in some other coding,So this is depending any other configuration?

  4. how can i check particular key==@”some Key value”?

  • 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-26T21:59:02+00:00Added an answer on May 26, 2026 at 9:59 pm

    code:

    NSMutableDictionary *testDictionary=[NSMutableDictionary dictionary];
        //  NSMutableDictionary *testDictionary=[[NSMutableDictionary alloc]init];
    
        [testDictionary setObject:@"Muhammed Musthafa" forKey:@"10005"];
        [testDictionary setObject:@"Lubaba p" forKey:@"10006"];
        [testDictionary setObject:@"Sahala Banu" forKey:@"10007"];
        [testDictionary setObject:@"Vishnu k" forKey:@"10008"];
        [testDictionary setObject:@"Shabeer PP" forKey:@"10009"];
        [testDictionary setObject:@"Sabeehath " forKey:@"10010"];
        [testDictionary setObject:@"Anusha GS" forKey:@"10011"];
        [testDictionary setObject:@"JINI KS" forKey:@"10012"];
        [testDictionary setObject:@"Athulya T" forKey:@"10013"];
        [testDictionary setObject:@"Midhun KS" forKey:@"10014"];
    
        for(NSString *kk in testDictionary)
        {
            NSString *fName;
            if([kk isEqualToString:@"10006"])
            {
                fName=[testDictionary objectForKey:kk];
    
            }
            if([kk isEqualToString: @"10007"])
            {
                fName=[testDictionary objectForKey:kk];
    
            }
            if([kk isEqualToString:@"10013"])
            {
                fName=[testDictionary objectForKey:kk];
            }
            NSLog(@"KEY=====%@ and  Value====%@",kk,fName);
    
        }
    

    output for your code.

    2011-11-17 12:47:59.910 test[12512:a0f] KEY=====10008 and  Value====(null)
    2011-11-17 12:47:59.910 test[12512:a0f] KEY=====10010 and  Value====(null)
    2011-11-17 12:47:59.911 test[12512:a0f] KEY=====10012 and  Value====(null)
    2011-11-17 12:47:59.911 test[12512:a0f] KEY=====10014 and  Value====(null)
    2011-11-17 12:47:59.912 test[12512:a0f] KEY=====10005 and  Value====(null)
    2011-11-17 12:47:59.912 test[12512:a0f] KEY=====10007 and  Value====Sahala Banu
    2011-11-17 12:47:59.912 test[12512:a0f] KEY=====10009 and  Value====Sahala Banu
    2011-11-17 12:47:59.913 test[12512:a0f] KEY=====10011 and  Value====Sahala Banu
    2011-11-17 12:47:59.913 test[12512:a0f] KEY=====10013 and  Value====Athulya T
    2011-11-17 12:47:59.913 test[12512:a0f] KEY=====10006 and  Value====Lubaba p  
    

    it working fine.
    After 10007 you dont have condition for for 10009 and 10011. so the fName value is not changed for that.
    When you use the == operator, you are comparing pointer values. This will only work when the objects you are comparing are exactly the same object, at the same memory address.

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

Sidebar

Related Questions

I`m a little confused about this point. Everything that I found in books, blogs,
I am little bit confuse about log4j in grails. I need to log info
I'm a little confused about how the standard library will behave now that Python
I am a little confused here. I would like to do something like this:
UPD. Hello, I know how code below is working. I know that cross, and
--I haven't develop any iPhone Web Application ever...so i am little bit confuse about
I built a little program that calculates the average of 15 numbers or less.
Little confused, the basic spring mvc app has this: app-config.xml <context:component-scan base-package=org.springframework.samples.mvc.basic /> and
My programing background is that I learned a little Java in school. JavaScript syntax
I am a newbie for Python, I am a little confuse of the relationship

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.