Re: Removing duplicates from NSMutableArray
Re: Removing duplicates from NSMutableArray
- Subject: Re: Removing duplicates from NSMutableArray
- From: Sherm Pendley <email@hidden>
- Date: Mon, 2 Dec 2002 17:47:49 -0500
On Monday, December 2, 2002, at 05:05 PM, Jan Van Tol wrote:
What is the best way to filter out duplicate NSStrings from an
NSMutableArray?
Traditional Perl wisdom is that, whenever you find yourself using the
words "unique" or "duplicate," you should be thinking about a hash
instead of an array. In Objective-C terms, that would be an NSDictionary
instead of an NSArray. That is, when you're building the list, instead
of doing this:
[myArray addObject: aString];
Do this:
[myDictionary setObject: @"" forKey: aString];
sherm--
If you listen to a UNIX shell, can you hear the C?
_______________________________________________
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.