SequenceableCollection.st
changeset 118 a0460951adf7
parent 95 d22739a0c6e9
child 159 514c749165c3
--- a/SequenceableCollection.st	Mon Aug 22 14:12:55 1994 +0200
+++ b/SequenceableCollection.st	Mon Aug 22 14:13:09 1994 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.13 1994-08-05 01:02:26 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.14 1994-08-22 12:13:09 claus Exp $
 '!
 
 !SequenceableCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.13 1994-08-05 01:02:26 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.14 1994-08-22 12:13:09 claus Exp $
 "
 !
 
@@ -865,18 +865,26 @@
 removeFromIndex:startIndex toIndex:endIndex
     "remove the elements stored at indexes between startIndex and endIndex.
 
-     Notice, that this is modifies the receiver NOT a copy.
+     Notice, that this is modifies the receiver - NOT a copy; 
+     therefore any other users of the receiver will also see this change.
      Also note, that it may be a slow operation for some collections due to the grow: 
      (i.e. for Strings and Arrays it is not recommened)"
 
     |newSize|
 
     newSize := self size - endIndex + startIndex - 1.
-    self replaceFrom:startIndex to:newSize with:self startingAt:(endIndex + 1).
-    self grow:newSize
+    newSize <= 0 ifTrue:[
+        self grow:0
+    ] ifFalse:[
+        self replaceFrom:startIndex to:newSize with:self startingAt:(endIndex + 1).
+        self grow:newSize
+    ]
 
     "
-     #(1 2 3 4 5 6 7 8 9 0) removeFromIndex:3 toIndex:5
+     #(1 2 3 4 5 6 7 8 9 0) asOrderedCollection removeFromIndex:3 toIndex:5 
+     #(1 2 3 4 5 6 7 8 9 0) removeFromIndex:3 toIndex:5 
+     #(1 2 3 4 5 6 7 8 9 0) asOrderedCollection removeFromIndex:1 toIndex:10 
+     #(1 2 3 4 5 6 7 8 9 0) removeFromIndex:1 toIndex:10 
     "
 !