Difference between revisions of "Collections"
Jump to navigation
Jump to search
m |
m |
||
Line 27: | Line 27: | ||
|Map/Hashtable | |Map/Hashtable | ||
|Arbitrary Association,Serializable | |Arbitrary Association,Serializable | ||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
Revision as of 23:02, 15 July 2012
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
Non plist files may also be serialized with an NSKeyedArchiver.
Weak and Strong
Garbage collection and ARC use weak and strong, it gets complicated: read Apple on Garbage Collection Apple on ARC