SequenceableCollection.st
changeset 348 5ac1b6b43600
parent 308 f04744ef7b5d
child 356 6c5ce0e1e7a8
--- a/SequenceableCollection.st	Wed May 17 14:17:43 1995 +0200
+++ b/SequenceableCollection.st	Thu May 18 17:10:35 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.27 1995-03-18 05:06:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.28 1995-05-18 15:10:08 claus Exp $
 '!
 
 !SequenceableCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.27 1995-03-18 05:06:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.28 1995-05-18 15:10:08 claus Exp $
 "
 !
 
@@ -1073,6 +1073,9 @@
 
 removeFromIndex:startIndex toIndex:endIndex
     "remove the elements stored at indexes between startIndex and endIndex.
+     Return the receiver.
+     Returning the receiver is a historic leftover - it may at one
+     time return a collection of the removed elements.
 
      Notice, that this is modifies the receiver - NOT a copy; 
      therefore any other users of the receiver will also see this change.
@@ -1108,8 +1111,8 @@
     "
 !
 
-removeAtIndex:index
-    "remove the argument stored at index and return it.
+removeAtIndex:anIndex
+    "remove the element stored at anIndex. Return the removed object.
 
      Notice, that this is modifies the receiver NOT a copy.
      Also note, that it may be a slow operation for some collections,
@@ -1118,11 +1121,13 @@
 
     |element|
 
-    element := self at:index.
-    self removeIndex:index.
+    element := self at:anIndex.
+    self removeFromIndex:anIndex toIndex:anIndex.
     ^ element
 
     "
+     #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeAtIndex:3
+     #(1 2 3 4 5) asOrderedCollection removeAtIndex:6
      #($a $b $c $d $e $f $g) removeAtIndex:3
     "
 !
@@ -1138,6 +1143,8 @@
     self removeFromIndex:index toIndex:index
 
     "
+     #(1 2 3 4 5 6 7 8 9) asOrderedCollection removeIndex:3
+     #(1 2 3 4 5) asOrderedCollection removeIndex:6
      #($a $b $c $d $e $f $g) removeIndex:3
     "
 !
@@ -1153,10 +1160,10 @@
     ^ self removeAtIndex:1
 
     "
-    |a|
+     |a|
      a := #(1 2 3 4 5 6).
      a removeFirst.
-     a
+     a 
     "
 !
 
@@ -1171,7 +1178,7 @@
     ^ self removeAtIndex:(self size) 
 
     "
-    |a|
+     |a|
      a := #(1 2 3 4 5 6).
      a removeLast.
      a