Collection.st
changeset 22168 d326c0a15bd9
parent 22059 e40ee0ef9640
child 22250 6badcfcf263c
--- a/Collection.st	Tue Aug 08 17:31:52 2017 +0200
+++ b/Collection.st	Tue Aug 08 19:34:52 2017 +0200
@@ -3302,6 +3302,22 @@
     "Modified: 20.4.1996 / 11:33:50 / cg"
 !
 
+keysAndValuesConform:aTwoArgBlock
+    "evaluate the argument, aBlock for every element in the collection,
+     passing both index and element as arguments.
+     Return false if any such evaluation returns false, true otherwise."
+
+    self keysAndValuesDo:[:index :el | 
+        (aTwoArgBlock value:index value:el) ifFalse:[^  false].
+    ].
+    ^  true
+
+    "
+     #(10 20 30 40) keysAndValuesConform:[:key :element | element = (key * 10) ]. 
+     #(10 20 30 33 40) keysAndValuesConform:[:key :element | element = (key * 10) ]. 
+    "
+!
+
 keysAndValuesDetect:aBlock ifNone:exceptionalValue
     "for each key-value pair in the receiver, evaluate the argument, aBlock
      and return the value for which aBlock returns true the very first time.