class: SequenceableCollection
authorClaus Gittinger <cg@exept.de>
Thu, 15 May 2014 19:20:35 +0200
changeset 16456 dcf3f5f016a4
parent 16455 cfac905b4275
child 16457 c25394c44436
class: SequenceableCollection changed: #removeAllSuchThat:
SequenceableCollection.st
--- a/SequenceableCollection.st	Thu May 15 19:20:21 2014 +0200
+++ b/SequenceableCollection.st	Thu May 15 19:20:35 2014 +0200
@@ -380,6 +380,8 @@
     ^ self == SequenceableCollection
 ! !
 
+
+
 !SequenceableCollection methodsFor:'Compatibility-Squeak'!
 
 allButFirst
@@ -1206,19 +1208,21 @@
 
     "/ this is a q&d implementation (possibly slow).
 
-    |runIndex removed element|
+    |runIndex removed element stop|
 
     removed := self species new.
 
     runIndex := 1.
-    [runIndex <= self size] whileTrue:[
-	element := self at:runIndex.
-	(aBlock value:element) ifTrue:[
-	    removed add:element.
-	    self removeAtIndex:runIndex
-	] ifFalse:[
-	    runIndex := runIndex + 1
-	]
+    stop := self size.
+    [runIndex <= stop] whileTrue:[
+        element := self at:runIndex.
+        (aBlock value:element) ifTrue:[
+            removed add:element.
+            self removeAtIndex:runIndex.
+            stop := self size. "/ could probably go along with stop := stop - 1
+        ] ifFalse:[
+            runIndex := runIndex + 1
+        ]
     ].
     ^ removed
 
@@ -7419,6 +7423,7 @@
     "Created: 14.2.1997 / 16:13:03 / cg"
 ! !
 
+
 !SequenceableCollection methodsFor:'searching'!
 
 detect:aBlock startingAt:startIndex
@@ -9562,11 +9567,11 @@
 !SequenceableCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.373 2014-05-13 17:54:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.374 2014-05-15 17:20:35 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.373 2014-05-13 17:54:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.374 2014-05-15 17:20:35 cg Exp $'
 ! !