Collection.st
changeset 20689 91b20c25f058
parent 20387 2f444d047b17
child 20728 83c74234945e
child 20790 ca9de5588d1f
--- a/Collection.st	Mon Oct 24 14:08:46 2016 +0200
+++ b/Collection.st	Mon Oct 24 15:10:53 2016 +0200
@@ -275,6 +275,7 @@
     ^ self newWithSize:n
 ! !
 
+
 !Collection class methodsFor:'Signal constants'!
 
 emptyCollectionSignal
@@ -549,6 +550,7 @@
     "Created: / 22-10-2008 / 21:29:27 / cg"
 ! !
 
+
 !Collection methodsFor:'accessing'!
 
 anElement
@@ -2517,12 +2519,13 @@
 
         individualResult := aBlock value:element.
         result isNil ifTrue:[
-            result := individualResult speciesForAdding new.
+            result := individualResult speciesForCollecting new.
         ].
         result addAll:individualResult.
     ].
 
-    ^ result ? #()
+    "do not answer an empty - possibly immutable - Array"
+    ^ result ? self speciesForCollecting new.
 
     "
      #(1 2 3 4) collectAll:[:n | Array new:n withAll:n ]  
@@ -2541,10 +2544,7 @@
 
     result := collectionClass new.
     self do:[:element | 
-        |individualResult|
-
-        individualResult := aBlock value:element.
-        result addAll:individualResult.
+        result addAll:(aBlock value:element).
     ].
 
     ^ result
@@ -6001,6 +6001,7 @@
     ^ aVisitor visitCollection:self with:aParameter
 ! !
 
+
 !Collection class methodsFor:'documentation'!
 
 version