 |
 |
can anybody explain me this sentence...
|
 |
|
 |
|
Forum Regular
Join Date: May 2001
Location: France
Status:
Offline
|
|
directly copied from Apple Cocoa doc :
file:///Developer/Documentation/Coco.../uid/10000034i , about NSDictionary
An NSDictionary manages a static array; that is, an array whose keys and values cannot be removed, replaced, or added to. However, the individual elements can be modified.
what are the individual elements ? i thought it was the key and value... what can be modified EXACTLY if it is not the key and the value ?
thanks
|
|
CarraFix, the traffic shaper for OS X !
Enjoy The [CFx] Community !
http://www.carrafix.com
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Oct 2001
Location: Sweden
Status:
Offline
|
|
Originally posted by altimac:
what are the individual elements ? i thought it was the key and value... what can be modified EXACTLY if it is not the key and the value ?
thanks [/B]
Say the value is a NSMutableArray. You may add and remove object from that NSMutableArray, but you can't remove or replace the NSMutableArray from the NSDictionary. Make sense?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Originally posted by altimac:
directly copied from Apple Cocoa doc :
file:///Developer/Documentation/Coco.../uid/10000034i , about NSDictionary
what are the individual elements ? i thought it was the key and value... what can be modified EXACTLY if it is not the key and the value ?
thanks
This is really pretty simple. The pointers stored in the dictionary cannot be changed, but the objects they point to can be.
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Jun 2001
Location: Savoy, IL USA
Status:
Offline
|
|
Originally posted by absmiths:
This is really pretty simple. The pointers stored in the dictionary cannot be changed, but the objects they point to can be.
True enough, but the guy sounds a little newbish, or not a native speaker. I'm not sure if discussing it in pointer logic will help him at all...
OK, my stab at rewording this:
An NSDictionary manages a static array; that is, an array whose keys and values cannot be removed, replaced, or added to after the initial creation of the dictionary. However, the individual elements can be modified. For example, if NSString objects are used as values in an NSDictionary, those objects may be modified via any NSString method. However, new NSString key/value pairs may not be added to the NSDictionary, nor may existing pairs be removed or replaced. See also: NSMutableDictionary
So, basically, you create the dictionary with a bunch of objects or another dictionary and then can look up values by key or change the contents of the value for any key, but you can't add, remove or replace key/value pairs to/from the dictionary.
Clear as mud? 
|
Software Architect, CodeTek Studios, Inc.
12" AlBook 867 (Combo drive) 640 MB/40 GB (work development machine) -- TiBook 400MHz/384MB/10GB (home machine)
CodeTek VirtualDesktop Pro: Power multitasking! -- DockExtender: Powerful, efficient launcher for Apps, Docs and everything else!
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: May 2001
Location: France
Status:
Offline
|
|
thanks, this is now clear as Alpes's spring water 
|
|
CarraFix, the traffic shaper for OS X !
Enjoy The [CFx] Community !
http://www.carrafix.com
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status:
Offline
|
|
Originally posted by Mskr:
OK, my stab at rewording this:
An NSDictionary manages a static array; that is, an array whose keys and values cannot be removed, replaced, or added to after the initial creation of the dictionary. However, the individual elements can be modified. For example, if NSString objects are used as values in an NSDictionary, those objects may be modified via any NSString method. However, new NSString key/value pairs may not be added to the NSDictionary, nor may existing pairs be removed or replaced. See also: NSMutableDictionary
hmmm... maybe NSString was not a very good example. NSMutableString, maybe? ? ? 
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Jun 2001
Location: Savoy, IL USA
Status:
Offline
|
|
Originally posted by Brass:
hmmm... maybe NSString was not a very good example. NSMutableString, maybe? ? ?  [/B][/QUOTE]
Ummmm.... Uhhhh.... Yeah, that's what I meant!!! 
|
Software Architect, CodeTek Studios, Inc.
12" AlBook 867 (Combo drive) 640 MB/40 GB (work development machine) -- TiBook 400MHz/384MB/10GB (home machine)
CodeTek VirtualDesktop Pro: Power multitasking! -- DockExtender: Powerful, efficient launcher for Apps, Docs and everything else!
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status:
Offline
|
|
I'd just like to say that it ought to be NSString and NSImmutableString, etc. This way it's the programmers who are skilled enough to want to enhance performace who have to do the extra research, forethinking, and typing, instead of the beginner who just wants an NSString.
That's just me though.
|
|
you are not your signature
|
| |
|
|
|
 |
|
 |
|
Banned
Join Date: Sep 2000
Location: Fightclub
Status:
Offline
|
|
Originally posted by Gametes:
I'd just like to say that it ought to be NSString and NSImmutableString, etc. This way it's the programmers who are skilled enough to want to enhance performace who have to do the extra research, forethinking, and typing, instead of the beginner who just wants an NSString.
That's just me though.
That's right: it's just you.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|