Re: NSDictionary allValues not mutable
Re: NSDictionary allValues not mutable
- Subject: Re: NSDictionary allValues not mutable
- From: Dave DeLong <email@hidden>
- Date: Sat, 09 Oct 2010 14:28:55 -0600
Of course it is. Suppose for a minute that [myMutableDictionary allValues] returned a mutable array. That means that you could add to and remove from this array with impunity.
Except... the objects in this array are supposed to have an associated key. If you remove an object from the array, then I suppose you could somehow get the dictionary to remove the key as well. But if you added an object to the array, what would its key be?
That's why the array is immutable.
Dave
On Oct 9, 2010, at 1:59 PM, Trygve Inda wrote:
> [myDict allValues] gets the correct array and works in the table, but it is made immutable.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden