Collection.st
changeset 18174 0bfcf5c08085
parent 17704 22b570284f10
child 18176 336e197be85b
--- a/Collection.st	Sat Mar 28 09:55:27 2015 +0100
+++ b/Collection.st	Sat Mar 28 09:55:33 2015 +0100
@@ -743,8 +743,7 @@
 
 last:n
     "return the n last elements of the collection.
-     No longer raises an error if there are not enough elements;
-     instead, returns what is there.
+     Raises an error if there are not enough elements in the receiver.
      For unordered collections, this simply returns the last
      n elements when enumerating them 
      (Warning: the contents of the returned collection is not deterministic in this case).
@@ -765,19 +764,16 @@
         coll add:e.
     ].
 
-    "/ OLD:
-    "/ remain ~~ 0 ifTrue:[
-    "/     "error if collection has not enough elements"
-    "/     ^ self notEnoughElementsError
-    "/ ].
+    remain ~~ 0 ifTrue:[
+        "error if collection has not enough elements"
+        ^ self notEnoughElementsError
+    ].
     ^ coll
 
     "
      #(1 2 3 4 5) last:3           
      #(1 2 3 4 5 6 7 8 9 0) asSet last:3           
      'hello world' last:5           
-     'hello' last:10           
-     'hello' asSet last:10           
     "
 
     "Modified (format): / 29-09-2011 / 10:16:22 / cg"
@@ -5747,11 +5743,11 @@
 !Collection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.361 2015-03-28 09:01:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.360 2015-03-28 08:55:33 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.361 2015-03-28 09:01:50 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.360 2015-03-28 08:55:33 cg Exp $'
 ! !