KeyedCollection.st
changeset 21368 1e4c41f4d3af
parent 19844 9a7234d4b08c
child 21369 d7b0866974d9
--- a/KeyedCollection.st	Tue Feb 07 11:11:22 2017 +0100
+++ b/KeyedCollection.st	Tue Feb 07 11:13:47 2017 +0100
@@ -87,27 +87,86 @@
     "Created: / 19.6.1998 / 00:48:23 / cg"
 !
 
-keyAtValue:value
+keyAtEqualValue:value
     "return the key under which value is stored.
-     Raise an error if not found"
+     Raise an error if not found.
+     This is a slow access, since the receiver is searched sequentially.
+     NOTICE:
+        The value is searched using identity compare"
 
-    ^ self keyAtValue:value ifAbsent:[self errorValueNotFound:value].
+    ^ self keyAtEqualValue:value ifAbsent:[self errorValueNotFound:value].
 
-    "Modified: / 19.6.1998 / 00:48:27 / cg"
-    "Created: / 19.6.1998 / 00:49:16 / cg"
+    "Created: / 07-02-2017 / 11:11:41 / cg"
 !
 
-keyAtValue:value ifAbsent:exceptionBlock
+keyAtEqualValue:value ifAbsent:exceptionBlock
+    "return the key under which value is stored.
+     If not found, return the value from evaluating exceptionBlock.
+     This is a slow access, since the receiver is searched sequentially.
+     NOTICE:
+        The value is searched using equality compare"
+
+    self keysAndValuesDo:[:elKey :elValue |
+        value = elValue ifTrue:[^ elKey]
+    ].
+    ^ exceptionBlock value
+
+    "Created: / 07-02-2017 / 11:12:03 / cg"
+!
+
+keyAtIdenticalValue:value
     "return the key under which value is stored.
-     If not found, return the value from evaluating exceptionBlock"
+     Raise an error if not found.
+     This is a slow access, since the receiver is searched sequentially.
+     NOTICE:
+        The value is searched using identity compare"
+
+    ^ self keyAtIdenticalValue:value ifAbsent:[self errorValueNotFound:value].
+
+    "Created: / 07-02-2017 / 11:12:23 / cg"
+!
+
+keyAtIdenticalValue:value ifAbsent:exceptionBlock
+    "return the key under which value is stored.
+     If not found, return the value from evaluating exceptionBlock.
+     This is a slow access, since the receiver is searched sequentially.
+     NOTICE:
+        The value is searched using identity compare"
 
     self keysAndValuesDo:[:elKey :elValue |
         value == elValue ifTrue:[^ elKey]
     ].
     ^ exceptionBlock value
 
-    "Modified: / 19.6.1998 / 00:48:27 / cg"
-    "Created: / 19.6.1998 / 00:50:34 / cg"
+    "Created: / 07-02-2017 / 11:12:46 / cg"
+!
+
+keyAtValue:value
+    "return the key under which value is stored.
+     Raise an error if not found.
+     This is a slow access, since the receiver is searched sequentially.
+     NOTICE:
+        The value is searched using identity compare.
+        use #keyAtEqualValue:ifAbsent: to compare for equality."
+
+    ^ self keyAtIdenticalValue:value.
+
+    "Created: / 19-06-1998 / 00:49:16 / cg"
+    "Modified (comment): / 07-02-2017 / 11:13:29 / cg"
+!
+
+keyAtValue:value ifAbsent:exceptionBlock
+    "return the key under which value is stored.
+     If not found, return the value from evaluating exceptionBlock.
+     This is a slow access, since the receiver is searched sequentially.
+     NOTICE:
+        The value is searched using identity compare;
+        use #keyAtEqualValue:ifAbsent: to compare for equality."
+
+    ^ self keyAtIdenticalValue:value ifAbsent:exceptionBlock.
+
+    "Created: / 19-06-1998 / 00:50:34 / cg"
+    "Modified: / 07-02-2017 / 11:13:20 / cg"
 !
 
 keys