class: Collection
authorClaus Gittinger <cg@exept.de>
Thu, 20 Jun 2013 13:29:55 +0200
changeset 15411 ab34e667612d
parent 15410 7da22680aea0
child 15412 e24915eae498
class: Collection added: #keysSorted:
Collection.st
--- a/Collection.st	Thu Jun 20 13:18:21 2013 +0200
+++ b/Collection.st	Thu Jun 20 13:29:55 2013 +0200
@@ -703,6 +703,15 @@
     ^ self keys asNewOrderedCollection sort
 !
 
+keysSorted:aBlock
+    "return the keys as a sorted sequenceable collection.
+     Some collections (which keep their keys already sorted) may
+     redefine this method to return the keys as they are kept internally.
+     The fallback here sorts them into an OrderedCollection"
+
+    ^ self keys asNewOrderedCollection sort:aBlock
+!
+
 last
     "return the last element of the collection.
      This should be redefined in subclasses."
@@ -4803,11 +4812,11 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.305 2013-06-20 10:20:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.306 2013-06-20 11:29:55 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.305 2013-06-20 10:20:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.306 2013-06-20 11:29:55 cg Exp $'
 ! !