Christoph Thiede uploaded a new version of Collections to project The Inbox: http://source.squeak.org/inbox/Collections-ct.1064.mcz
==================== Summary ====================
Name: Collections-ct.1064 Author: ct Time: 2 March 2024, 6:17:27.319276 pm UUID: c7986d41-b20e-0b4f-804d-c7e059095676 Ancestors: Collections-mt.1058
Proposal: Complements sorting protocol on Dictionary by adding #withKeysSorted and #withValuesSorted[:|Safely].
Examples: (self systemNavigation allClasses groupBy: #category) withKeysSorted. (Dictionary methodDict collect: [:ea | ea getSource asString occurrencesOfString: 'sort']) withValuesSorted. (Dictionary methodDict collect: [:ea | ea getSource asString occurrencesOfString: 'sort']) withValuesSorted: #yourself descending.
=============== Diff against Collections-mt.1058 ===============
Item was added: + ----- Method: Dictionary>>withKeysSorted (in category 'sorting') ----- + withKeysSorted + + ^ self withKeysSorted: nil!
Item was added: + ----- Method: Dictionary>>withValuesSorted (in category 'sorting') ----- + withValuesSorted + + ^ self withValuesSorted: nil!
Item was added: + ----- Method: Dictionary>>withValuesSorted: (in category 'sorting') ----- + withValuesSorted: aSortBlockOrNil + + | sorted | + sorted := OrderedDictionary new: self size. + (self associations sorted: + (aSortBlockOrNil + ifNil: [[:someAssoc :otherAssoc | someAssoc value <= otherAssoc value]] + ifNotNil: [[:someAssoc :otherAssoc | aSortBlockOrNil value: someAssoc value value: otherAssoc value]])) + do: [:assoc | + sorted add: assoc]. + ^ sorted!
Item was added: + ----- Method: Dictionary>>withValuesSortedSafely (in category 'sorting') ----- + withValuesSortedSafely + + ^ self withValuesSorted: [:x :y | x compareSafely: y]!
squeak-dev@lists.squeakfoundation.org