diff --git a/src/NewTools-Inspector-Extensions/Bag.extension.st b/src/NewTools-Inspector-Extensions/Bag.extension.st index e6fd73d2..090f855b 100644 --- a/src/NewTools-Inspector-Extensions/Bag.extension.st +++ b/src/NewTools-Inspector-Extensions/Bag.extension.st @@ -2,20 +2,26 @@ Extension { #name : 'Bag' } { #category : '*NewTools-Inspector-Extensions' } Bag >> inspectionItems: aBuilder [ - - ^ aBuilder newTable - addColumn: (SpStringTableColumn new - title: 'Items'; - evaluated: [ :each | StObjectPrinter asTruncatedTextFrom: each key ]; - beNotExpandable; - beSortable; - yourself); - addColumn: (SpStringTableColumn new - title: 'Occurences'; - evaluated: [ :each | StObjectPrinter asTruncatedTextFrom: (self occurrencesOf: each key) ]; - beSortable; - yourself); - items: contents associations; - yourself + + | sortFuction | + sortFuction := [ :c1 :c2 | c1 value > c2 value ]. + + ^ aBuilder newTable + addColumn: (SpStringTableColumn new + title: 'Items'; + evaluated: [ :each | + StObjectPrinter asTruncatedTextFrom: each key ]; + beNotExpandable; + beSortable; + yourself); + addColumn: (SpStringTableColumn new + title: 'Occurences'; + evaluated: [ :each | + StObjectPrinter asTruncatedTextFrom: + (self occurrencesOf: each key) ]; + beSortable; + yourself); + items: (contents associations sort: sortFuction); + yourself ]