>>>>> "r00t" == r00t uk <[email protected]> writes:
r00t> I have a Dictionary object containing key value objects. I want to be
r00t> able to retrieve the key-values by sort order on the key field. Any
r00t> ideas or pointers would be greatly appreciated. At the moment
r00t> everything is being returned unsorted.
r00t> The key field is a year date and the value a URL to that year's archive.
This might be a bit perverse, but if you flatten the dictionary into
an OrderedCollection of Associations, you can sort those:
yourDictionary associations asSortedCollection do: [:each |
year := each key.
url := each value.
...
]
Browse the protocol of Association to know why #< does the right
thing for a sort.
There might be a far better way.. but I found this in a few minutes.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
Beginners mailing list
[email protected]
http://lists.squeakfoundation.org/mailman/listinfo/beginners