PDA

View Full Version : NSMutableSet




Duke Leto
Feb 20, 2009, 06:58 PM
I've been looking through the docs.. and it seems that the best way to store data that can will be most likely removed is by using a set. I have previously made a linked list in ActionScript, but my Hard drive died.

It just seems too good to be true! Is it possible that an NSMutableSet is basically a linked list?



autorelease
Feb 20, 2009, 07:28 PM
I've been looking through the docs.. and it seems that the best way to store data that can will be most likely removed is by using a set. I have previously made a linked list in ActionScript, but my Hard drive died.

It just seems too good to be true! Is it possible that an NSMutableSet is basically a linked list?

I'm sure it's implemented with a hash table to allow amortized constant-time operations. Lookups in a linked list are very slow. I doubt linked lists are used anywhere in Foundation.

Catfish_Man
Feb 20, 2009, 09:54 PM
Certain implementations of NSMutableArray are looped linked lists internally, iirc. NSMutableSet is likely a tree or hash table though.