WeakIdentityDictionary.st
changeset 20990 38e8d0c58aa1
parent 20702 5dfa0631a814
child 20992 a2eba1cff036
--- a/WeakIdentityDictionary.st	Fri Nov 18 16:04:04 2016 +0100
+++ b/WeakIdentityDictionary.st	Fri Nov 18 16:05:23 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
@@ -67,6 +69,26 @@
 "
 ! !
 
+!WeakIdentityDictionary methodsFor:'acessing'!
+
+keys
+    "return a collection containing all valid keys of the receiver"
+
+    |keySet|
+
+    keySet := self emptyCollectionForKeys.
+    keyArray validElementsDo:[:key |
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
+            key == NilEntry ifTrue:[
+                keySet add:nil.
+            ] ifFalse:[
+                keySet add:key.
+            ]
+        ]
+    ].
+    ^ keySet
+! !
+
 !WeakIdentityDictionary methodsFor:'adding & removing'!
 
 at:key ifAbsent:exceptionBlock