SequenceableCollection.st
changeset 22292 c8d2e64970fd
parent 22277 fa9b693b2809
child 22324 61d66473b029
--- a/SequenceableCollection.st	Wed Sep 27 15:58:44 2017 +0200
+++ b/SequenceableCollection.st	Mon Oct 09 17:31:09 2017 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -195,16 +193,18 @@
     "return a new collection of size.
      For variable size collections, this is different from #new:,
      in that #new: creates an empty collection with preallocated size,
-     while #withSize: creates a non empty one."
+     while #newWithSize: creates a non empty one."
 
     ^ (self new:size) grow:size.
 
     "
      (OrderedCollection new:10) inspect.
-     (OrderedCollection withSize:10) inspect.
+     (OrderedCollection newWithSize:10) inspect.
      (Array new:10) inspect.
-     (Array withSize:10) inspect.
-    "
+     (Array newWithSize:10) inspect.
+    "
+
+    "Modified (comment): / 09-10-2017 / 17:03:18 / stefan"
 ! !
 
 !SequenceableCollection class methodsFor:'Signal constants'!
@@ -2573,15 +2573,15 @@
     "return a new string collection containing the elements;
      these ought to be strings. (i.e. String or Text instances)"
 
-    |newColl sz|
+    |sz|
 
     sz := self size.
-    newColl := StringCollection newWithSize:sz.
-    newColl replaceFrom:1 to:sz with:self startingAt:1.
-    ^ newColl
-
-    "Created: 18.5.1996 / 13:53:55 / cg"
-    "Modified: 18.5.1996 / 14:00:16 / cg"
+    ^ (StringCollection newWithSize:sz)
+        replaceFrom:1 to:sz with:self startingAt:1;
+        yourself.
+
+    "Created: / 18-05-1996 / 13:53:55 / cg"
+    "Modified: / 09-10-2017 / 17:05:19 / stefan"
 !
 
 decodeAsLiteralArray
@@ -5052,9 +5052,9 @@
 
     | mySize "{ Class: SmallInteger }" retval |
 
-    mySize := self size.
-    retval := Array ofSize: mySize - 1.
-    1 to: mySize - 1 do: [:i | 
+    mySize := self size - 1.
+    retval := Array newWithSize: mySize.
+    1 to: mySize do: [:i | 
         retval at: i put: (aTwoArgBlock value: (self at: i) value: (self at: i + 1)) 
     ].
     ^ retval
@@ -5064,10 +5064,12 @@
 
      'hello world how nice' overlappingPairsCollect: [:a :b | a,b]
 
-     (('hello worlld aa bb' overlappingPairsCollect: [:a :b | a,b]) 
+     (('hello world aa bb' overlappingPairsCollect: [:a :b | a,b]) 
         asBag select:[:p | p asSet size = 1])
              valuesSortedByCounts first
     "
+
+    "Modified (comment): / 09-10-2017 / 17:09:01 / stefan"
 !
 
 overlappingPairsDo: aTwoArgBlock