OrderedCollection.st
branchjv
changeset 18814 8e75e91e5e67
parent 18383 3a40da3624b7
parent 18811 54e839ea9d44
child 18883 765cf9dca720
--- a/OrderedCollection.st	Mon Oct 05 09:09:03 2015 +0100
+++ b/OrderedCollection.st	Wed Oct 07 06:51:59 2015 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -293,6 +291,19 @@
     "Modified: / 12.11.1997 / 17:56:05 / cg"
 !
 
+at:anInteger ifAbsent:exceptionValue
+    "return the element at index, anInteger.
+     If the index is invalid, return the value from exceptionValue"
+
+    |idx "{ Class: SmallInteger }"|
+
+    idx := anInteger + firstIndex - 1.
+    ((anInteger < 1) or:[idx > lastIndex]) ifTrue:[
+        ^ exceptionValue value
+    ].
+    ^ contentsArray basicAt:idx
+!
+
 at:anInteger put:anObject
     "set the element at index, to be anInteger.
      Return anObject (sigh)."
@@ -2175,10 +2186,10 @@
 !OrderedCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.120 2015-05-20 10:16:35 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.120 2015-05-20 10:16:35 cg Exp $'
+    ^ '$Header$'
 ! !