checkin from browser
authorClaus Gittinger <cg@exept.de>
Sun, 10 Oct 1999 13:18:58 +0200
changeset 4892 694903566445
parent 4891 56cd253f920b
child 4893 a645a54ced2a
checkin from browser
Collection.st
--- a/Collection.st	Sat Oct 09 18:11:57 1999 +0200
+++ b/Collection.st	Sun Oct 10 13:18:58 1999 +0200
@@ -993,7 +993,11 @@
      May be redefined by some subclasses for optimal performance
      (not creating a garbage collection)"
 
-    ^ (self collect: collectBlock) select: selectBlock
+    ^ (self collect:collectBlock) select:selectBlock
+
+    "
+     #(1 2 3 4 5 6 7) collect:[:i | i * 2] thenSelect:[:i | i < 10]
+    "
 
 !
 
@@ -1300,6 +1304,18 @@
     "
 !
 
+select:selectBlock thenCollect:collectBlock
+    "combination of select followed by collect.
+     May be redefined by some subclasses for optimal performance
+     (not creating a garbage collection)"
+
+    ^ (self select:selectBlock) collect:collectBlock
+
+    "
+     #(1 2 3 4 5 6 7) select:[:i | i even] thenCollect:[:i | i * 2]
+    "
+!
+
 triplesDo:aBlock
     "evaluate the argument, aBlock for every element in the collection,
      which is supposed to consist of 3-element collections.
@@ -1880,6 +1896,6 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.87 1999-10-09 15:30:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.88 1999-10-10 11:18:58 cg Exp $'
 ! !
 Collection initialize!