SequenceableCollection.st
changeset 15174 120368418a69
parent 15156 e72a9919609c
child 15214 51fa92a56848
child 18057 8da7c39a6322
--- a/SequenceableCollection.st	Fri Apr 26 11:04:54 2013 +0200
+++ b/SequenceableCollection.st	Fri Apr 26 13:36:40 2013 +0200
@@ -368,7 +368,6 @@
     ^ self == SequenceableCollection
 ! !
 
-
 !SequenceableCollection methodsFor:'Compatibility-Squeak'!
 
 allButFirst
@@ -688,7 +687,6 @@
     ^ self replaceFrom:start to:stop with:anArray startingAt:repStart
 ! !
 
-
 !SequenceableCollection methodsFor:'accessing'!
 
 after:anObject
@@ -1069,6 +1067,51 @@
     "
 !
 
+addAll:aCollection beforeIndex:index
+    "insert all elements of the argument, anObject to become located at index.
+     The collection may be unordered, but then order of the sliced-in elements
+     is undefined.
+     Return the receiver."
+
+    |idx|
+
+    idx := index.
+    aCollection do:[:element |
+        self add:element beforeIndex:idx.
+        idx := idx + 1.
+    ].
+
+    "
+     |c|
+     c := #(1 2 3 4) asOrderedCollection.
+     c addAll:'here' beforeIndex:3   
+    "
+    "
+     |c|
+     c := #(1 2 3 4) asOrderedCollection.
+     c removeFirst.
+     c addAll:'here' beforeIndex:3   
+    "
+    "
+     |c|
+     c := #(1 2 3 4) asOrderedCollection.
+     c addAll:'here' beforeIndex:1    
+    "
+    "
+     |c|
+     c := #(1 2 3 4) asOrderedCollection.
+     c addAll:'here' beforeIndex:5     
+    "
+
+    "
+     |c|
+     c := #(1 2 3 4) asOrderedCollection.
+     c addAll:('hello' asSet) beforeIndex:3
+    "
+
+    "Modified: 15.4.1997 / 12:43:59 / cg"
+!
+
 addFirst:anObject
     "prepend the argument, anObject to the collection.
      Return the argument, anObject.
@@ -6741,7 +6784,6 @@
     "Created: 14.2.1997 / 16:13:03 / cg"
 ! !
 
-
 !SequenceableCollection methodsFor:'searching'!
 
 detect:aBlock startingAt:startIndex
@@ -8870,11 +8912,11 @@
 !SequenceableCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.335 2013-04-25 13:06:28 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.336 2013-04-26 11:36:40 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.335 2013-04-25 13:06:28 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.336 2013-04-26 11:36:40 cg Exp $'
 ! !