Iterator.st
changeset 3129 5cca8a5308fc
parent 2997 c752298b3db5
child 3130 5b401335f9fd
--- a/Iterator.st	Thu Oct 17 15:03:59 2013 +0200
+++ b/Iterator.st	Mon Oct 21 17:09:39 2013 +0200
@@ -308,6 +308,25 @@
 
 !Iterator methodsFor:'enumerating'!
 
+collect:aBlock as:aClass
+    "Reimplemented here as Iterator does not support #size"
+
+    |newCollection|
+
+    newCollection := aClass new.
+    self do:[:el |
+        newCollection add:(aBlock value:el).
+    ].
+    ^ newCollection
+
+    "
+     #(one two three four five six) collect:[:element | element asUppercase] as:OrderedCollection
+     'abcdef' collect:[:char | char digitValue] as:ByteArray
+    "
+
+    "Created: / 21-10-2013 / 16:07:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 do: aBlock
     block value: aBlock
 !
@@ -398,10 +417,10 @@
 !Iterator class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Iterator.st,v 1.25 2013-05-21 20:22:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Iterator.st,v 1.26 2013-10-21 15:09:39 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic2/Iterator.st,v 1.25 2013-05-21 20:22:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Iterator.st,v 1.26 2013-10-21 15:09:39 vrany Exp $'
 ! !