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

  • Home
  • SEARCH
  • 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 8223639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:46:39+00:00 2026-06-07T14:46:39+00:00

I have the need to uses custom class that I wrote as a key

  • 0

I have the need to uses custom class that I wrote as a key in an NSMutableDictionary (A Socket class, in this case.)

In Java when I use a HashMap or TreeMap, the object requires either a hash function or comparator function respectively for the dictionary to operate. In general, dictionaries need to know some way to compare keys.

From what I’ve read in the documentation, it doesn’t look like I have to do this to use NSMutableDictionary though. Is that correct? And if it is, does anyone know how they implemented key comparison?

  • 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-07T14:46:43+00:00Added an answer on June 7, 2026 at 2:46 pm

    As long as the key conforms to NSCopying (which NSObject does not, but many things do), it can be used as a key. The key will be copied using copyWithZone:.

    Regarding how this works, it works just as you note in Java. “The object requires either a hash function or comparator function respectively for the dictionary to operate.” Every NSObject implements both hash and isEqual:.

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

Sidebar

Related Questions

I have a class that uses 5.3 feature anonymous function ( https://github.com/JeffreyWay/Easy-WordPress-Custom-Post-Types/blob/master/jw_custom_posts.php ), but
I have written a ListActivity class that uses a custom ArrayAdapter and Holders. I
I currently have a custom log manager that internally uses java.util.Formatter . The main
I have a Rails application that uses ActiveRecordStore for sessions. I need a PHP
I have an ISAPI Application in Delphi 6 that uses WebBroker. I need to
I need some clarification. I have a Reportwriter dll that uses Crystal Reports. It
I have a custom class that has quite a few accessor methods for customizing
I have my own custom LinkedList class that has a pointer to the first
I have a view that uses one of the class-based generic views (derives from
Ok I have a page that uses 3 plugins and custom code. Fullscreenr ScrollTo

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.