Collections
Collections are any
Class | Generic Name | Capability | Purpose |
---|---|---|---|
NSArray | Array List / Linked List | Rapid Access, Slow Mutation | A reizable list of items. NB Each node of the the list is just a reference, the list need not be of a single type. |
NSSet | Unordered List | Slow Access, Rapid Mutation | |
NSIndexedSet | Indexed Unordered List | Fast Access, Fast Mutation | |
NSDictionary | Map/Hashtable | Arbitrary Association,Serializable |
Mutability
For each immutable class there is a mutable equivalent, to make a collection mutable use "mutableCopy:". Alternatly when creating the object create an instace of the mutable version instead.
Serialization
Dictionaries may only serialize known classes to plist files, they are:
- NSDictionary(must cointain only serializable classes)
- NSNumber
- NSArray(must cointain only serializable classes)
- NSString
see also NSKeyedArchiver.
Weak and Strong
Garbage collection and ARC use weak and strong, it gets complicated: read Apple on Garbage Collection Apple on ARC