Collection.st
changeset 22013 76ad7c615e9b
parent 21735 abe6a5d8dd92
child 22045 a8c564f53460
--- a/Collection.st	Thu Jul 13 20:39:39 2017 +0200
+++ b/Collection.st	Thu Jul 13 20:46:07 2017 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -277,7 +275,6 @@
     ^ self newWithSize:n
 ! !
 
-
 !Collection class methodsFor:'Signal constants'!
 
 emptyCollectionSignal
@@ -347,7 +344,6 @@
     ^ self
 ! !
 
-
 !Collection methodsFor:'Compatibility-ANSI'!
 
 identityIncludes:anObject
@@ -561,7 +557,6 @@
     "Created: / 22-10-2008 / 21:29:27 / cg"
 ! !
 
-
 !Collection methodsFor:'accessing'!
 
 anElement
@@ -1031,11 +1026,12 @@
     ^ aCollection
 
     "
-     #(1 2 3 4) copy addAll:#(5 6 7 8)
-     #(1 2 3 4) asOrderedCollection addAll:#(5 6 7 8)
-    "
-
-    "Modified: 12.4.1996 / 13:29:20 / cg"
+     #(1 2 3 4) copy addAll:#(5 6 7 8); yourself
+     #(1 2 3 4) asOrderedCollection addAll:#(5 6 7 8); yourself
+    "
+
+    "Modified: / 12-04-1996 / 13:29:20 / cg"
+    "Modified (comment): / 13-07-2017 / 20:45:42 / cg"
 !
 
 addAll:aCollectionOfObjects withOccurrences:anInteger
@@ -1104,6 +1100,23 @@
     "
 !
 
+addAllReversed:aCollection
+    "add all elements of the argument, aCollection in reverse order to the receiver.
+     Returns the argument, aCollection (sigh)."
+
+    aCollection reverseDo:[:element |
+        self add:element
+    ].
+    ^ aCollection
+
+    "
+     #(1 2 3 4) copy addAllReversed:#(5 6 7 8); yourself
+     #(1 2 3 4) asOrderedCollection addAllReversed:#(5 6 7 8); yourself
+    "
+
+    "Created: / 13-07-2017 / 20:45:17 / cg"
+!
+
 addFirst:anObject
     "add the argument, anObject to the receiver.
      If the receiver is ordered, the new element will be added at the beginning.
@@ -4380,7 +4393,7 @@
     aStream nextPut:$)
 
     "
-     #(1 2 3 'hello' $a $ü) printOn:Transcript
+     #(1 2 3 'hello' $a $ü) printOn:Transcript
      (Array new:100000) printOn:Transcript
      (Array new:100000) printOn:Stdout
      (Array new:100000) printString size
@@ -5739,7 +5752,7 @@
 includesAll:aCollection
     "return true if the receiver includes all elements of
      the argument, aCollection; false if any is missing.
-     Notice: this method has O² runtime behavior and may be
+     Notice: this method has O² runtime behavior and may be
              slow for big receivers/args.
              Think about using a Set, or Dictionary."
 
@@ -5759,7 +5772,7 @@
      Return false if it includes none.
      Uses #= (value compare)
      Notice:
-        this method has O² runtime behavior for some subclasses and may be slow for big receivers/args.
+        this method has O² runtime behavior for some subclasses and may be slow for big receivers/args.
         Think about using a Set or Dictionary.
         Some speedup is also possible, by arranging highly
         probable elements towards the beginning of aCollection, to avoid useless searches.
@@ -5836,7 +5849,7 @@
      Return false if it includes none.
      Use identity compare for comparing.
      Notice:
-        this method has O² runtime behavior for some subclasses and may be slow for big receivers/args.
+        this method has O² runtime behavior for some subclasses and may be slow for big receivers/args.
         Think about using a Set or Dictionary.
         Some speedup is also possible, by arranging highly
         probable elements towards the beginning of aCollection, to avoid useless searches."
@@ -6052,7 +6065,6 @@
     ^ aVisitor visitCollection:self with:aParameter
 ! !
 
-
 !Collection class methodsFor:'documentation'!
 
 version