I wonder if Objective-C offers support for Lists? Or .. is NSMutableArray a way to go, instead?
I wonder if Objective-C offers support for Lists ? Or .. is NSMutableArray a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes
NSMutableArray(Mac, iOS) would in most cases be the appropriate class for lists (withNSArraybeing the immutable counterpart).Contrary to Java’s collection classes Objective-C‘s (or rather Foundation‘s) arrays are opaque class clusters that completely hide their implementation.
Edit: snip (see comment by orange80)
While Java has a ton of collection classes such as:
HashSetTreeSetLinkedHashSetArrayListLinkedListPriorityQueueHashMapTreeMapLinkedHashMapWeakHashMapIdentityHashMapCopyOnWriteArrayListCopyOnWriteArraySetEnumSetEnumMapConcurrentLinkedQueueLinkedBlockingQueueArrayBlockingQueuePriorityBlockingQueueDelayQueueSynchronousQueueConcurrentHashMapObjective-C however (again, actually the Foundation SDK) only provides a very limited number of collection classes:
CFMutableDictionaryCFMutableBagCFMutableBitVectorCFMutableSetCFMutableArrayCFBinaryHeapCFMutableTreeor preferably their NS-equivalents:
NSMutableDictionaryNSDictionaryNSMutableSetNSSetNSCountedSetNSMutableArrayNSArrayFor a full insight in the matter I recommend this read:
http://ridiculousfish.com/blog/posts/array.html (the author is a member of Apple’s Foundation Team)