#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Mon, 17 Jul 2017 17:17:33 +0200
changeset 22046 f3e5bbbbed6d
parent 22045 a8c564f53460
child 22047 e606eb029294
#FEATURE by cg class: Collection added: #firstValue #lastValue
Collection.st
--- a/Collection.st	Mon Jul 17 17:12:37 2017 +0200
+++ b/Collection.st	Mon Jul 17 17:17:33 2017 +0200
@@ -750,6 +750,16 @@
     "Modified (comment): / 13-02-2017 / 19:58:28 / cg"
 !
 
+firstValue
+    "return the first value in the collection.
+     Normally the same as #first, but some collections prefer to return
+     an association from #first; there it is redefined"
+
+    ^ self first
+
+    "Created: / 17-07-2017 / 17:17:04 / cg"
+!
+
 fourth
     "return the fourth element of the collection.
      For unordered collections, this simply returns the fourth
@@ -878,6 +888,16 @@
     "Created: 6.2.1996 / 15:27:49 / cg"
 !
 
+lastValue
+    "return the last value in the collection.
+     Normally the same as #last, but some collections prefer to return
+     an association from #last; there it is redefined"
+
+    ^ self last
+
+    "Created: / 17-07-2017 / 17:16:44 / cg"
+!
+
 nth:n
     "return the nth element of the collection.
      For unordered collections, this simply returns the nth