• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Subclassing NS(Mutable)Dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NS(Mutable)Dictionary


  • Subject: Re: Subclassing NS(Mutable)Dictionary
  • From: email@hidden
  • Date: Tue, 23 Jul 2002 19:17:18 -0400

This is what I was looking for. Thank you.


On Tuesday, July 23, 2002, at 06:51 PM, Ondra Cada wrote:

In short, by not subclassing, but embedding (as the Class Cluster document says, or at least, had said when I've learnt it brand new in OpenStep ages ago).

Make a new class with API you like, and make it contain the appropriate objects -- something like

@interface OrderedDict {
NSMutableArray *array;
NSMutableDictionary *dictionary;
}
...
-(void)setObject:o forKey:k;
...
@end
@implementation OrderedDict
...
-(void)setObject:o forKey:k {
[dictionary setObject:o forKey:k];
[array addObject:k];
[array sortUsingSelector:@selector(caseInsensitiveCompare:)];
}
...
@end
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Subclassing NS(Mutable)Dictionary (From: Ondra Cada <email@hidden>)

  • Prev by Date: How to find icon file path?
  • Next by Date: arrayWithObjects question
  • Previous by thread: Re: Subclassing NS(Mutable)Dictionary
  • Next by thread: Writing (not reading) XML
  • Index(es):
    • Date
    • Thread