SortColl.st
changeset 184 d795f0b1934a
parent 159 514c749165c3
child 202 40ca7cc6fb9c
--- a/SortColl.st	Fri Oct 28 02:29:18 1994 +0100
+++ b/SortColl.st	Fri Oct 28 02:29:56 1994 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/SortColl.st,v 1.11 1994-10-10 00:28:38 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SortColl.st,v 1.12 1994-10-28 01:29:56 claus Exp $
 '!
 
 !SortedCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/SortColl.st,v 1.11 1994-10-10 00:28:38 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SortColl.st,v 1.12 1994-10-28 01:29:56 claus Exp $
 "
 !
 
@@ -213,6 +213,26 @@
     ^ super asSortedCollection
 ! !
 
+!SortedCollection methodsFor:'enumeration'!
+
+collect:aBlock
+    "evaluate the argument, aBlock for every element in the collection
+     and return a collection of the results. Redefined to return an OrderedCollection;
+     see X3J20 spec. (SortedCollection>>collect: should return an OrderedCollection)"
+
+    |newCollection
+     start  "{ Class:SmallInteger }"
+     stop   "{ Class:SmallInteger }" |
+
+    newCollection := OrderedCollection new:(self size).
+    stop := lastIndex.
+    start := firstIndex.
+    start to:stop do:[:index |
+	newCollection add:(aBlock value:(contentsArray at:index)).
+    ].
+    ^ newCollection
+! !
+
 !SortedCollection methodsFor:'testing'!
 
 includes:anObject