OrderedDictionary.st
changeset 15451 8be26a61d680
parent 15134 84e886ef6b5f
child 15534 808593c7efb3
--- a/OrderedDictionary.st	Mon Jul 01 11:23:23 2013 +0000
+++ b/OrderedDictionary.st	Mon Jul 01 16:48:19 2013 +0200
@@ -604,7 +604,8 @@
 !
 
 keysAndValuesDo:aBlock
-    "perform the block for all keys in the collection.
+    "perform the block for all keys and values in the collection.
+     Enumerate them in the order by which they were added.
 
      See also:
         #associationsDo:   (which passes key-value associations)
@@ -621,6 +622,25 @@
     "Modified: / 15.10.1999 / 16:53:50 / cg"
 !
 
+keysAndValuesReverseDo:aBlock
+    "perform the block for all keys and values in the collection.
+     Enumerate them in the reverse order from which they were added.
+
+     See also:
+        #associationsDo:   (which passes key-value associations)
+        #keysAndValuesDo:  (which passes keys & values separately)
+        #do:               (which passes values only)
+
+     WARNING: do not add/remove elements while iterating over the receiver.
+              Iterate over a copy to do this."
+
+    order reverseDo: [:key | aBlock value:key value:(self at: key)].
+
+    "Modified: / 26.6.1999 / 10:55:30 / ps"
+    "Created: / 15.10.1999 / 16:49:31 / cg"
+    "Modified: / 15.10.1999 / 16:53:50 / cg"
+!
+
 keysDo:aBlock
     "evaluate the argument, aBlock for every key in the collection.
 
@@ -961,10 +981,10 @@
 !OrderedDictionary class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.40 2013-04-25 07:18:43 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.41 2013-07-01 14:48:19 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.40 2013-04-25 07:18:43 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.41 2013-07-01 14:48:19 cg Exp $'
 ! !