SequenceableCollection.st
branchjv
changeset 24910 536a36729d88
parent 24909 be15895f3e50
child 24911 fe2e546e6f2f
--- a/SequenceableCollection.st	Tue Aug 27 10:39:48 2019 +0200
+++ b/SequenceableCollection.st	Tue Aug 27 11:05:55 2019 +0200
@@ -7961,11 +7961,10 @@
      So this is useful for seldom encountered map operations, for which a more
      efficient Dictionary is not wanted."
 
-    |idx|
-
-    idx := self indexOf:key.
-    idx == 0 ifTrue:[^ exceptionValue value].
-    ^ self at:(idx + 1)
+    self pairWiseDo:[:eachKey :eachValue |
+        key = eachKey ifTrue:[^ eachValue].
+    ].
+    ^ exceptionValue value
 
     "
      #(
@@ -7997,11 +7996,10 @@
      So this is useful for seldom encountered map operations, for which a more
      efficient Dictionary is not wanted."
 
-    |idx|
-
-    idx := self indexOf:value.
-    idx == 0 ifTrue:[^ exceptionValue value].
-    ^ self at:(idx - 1)
+    self pairWiseDo:[:eachKey :eachValue |
+        value = eachValue ifTrue:[^ eachKey].
+    ].
+    ^ exceptionValue value
 
     "
      #(