Opps! An early morning typo.
The correct sorted answer is:
a Dictionary('1a'->'object 1a' '2b'->'object 2b' '3c'->'object 3c' )
On Wed, Aug 26, 2009 at 3:58 AM, Overcomer Man overcomer.man@gmail.comwrote:
I know this was already covered but to simplify the explination for the beginner:
Sort is automatic for Dictionaries.
| dict | dict := Dictionary new. dict at: '3c' put: 'object 3c'. dict at: '1a' put: 'object 1a'. dict at: '2b' put: 'object 2b'. dict
Evaluating the code with "Print It" will respond: a Dictionary('1a'->'object 1a' '2b'->'object 2a' '3c'->'object 3a' )
A useful capability of Dictionaries is merging files by key. Add old objects then overwriting with new objects and sorting is automatic.
| dict | dict := Dictionary new. dict at: '3c' put: 'object 3c'. dict at: '1a' put: 'object 1a'. dict at: '3c' put: 'new object 3c'. dict
a Dictionary('1a'->'object 1a' '3c'->'new object 3c' )