[squeak-dev] sorting a dictionary by value

Joseph J Alotta joseph.alotta at gmail.com
Fri Oct 5 04:53:03 UTC 2012

Never mind, I found it:

summarybystock associations asSortedCollection: [:x :y | x value < y value] =>

a SortedCollection('LOGL'->100.0 'LUX'->271.53 'TGT'->275.08 'CMS'->276.35 'NSRGY'->285.78 'UN'->289.89 'VLKAY'->291.22




There were some answers for sorting a dictionary by key, but nothing on sorting by value.

dict associations asSortedCollection =>

a SortedCollection('ABB'->1625.68 'ABT'->41514.16 'ABV'->11393.37 'ACCO'->954.77 'ACMP'->4626.56 'ADC'->1151.66 'ADI'->17375.44 'ADP'->17762.98 'ADUS'->1219.63 'AEE'->30939.24 'AEO'->8560.08 'AEP'->94319.6 'AHGP'->2895.92 'ALE'->6510.47 'ALG'->4345.05 

But I want to sort by the value?

Thank you for your help,


More information about the Squeak-dev mailing list