" Smalltalk/IdentityDictionary.st -*- Smalltalk -*- " IdentityDictionary : Dictionary () IdentityDictionary scanFor: anObject [ | start finish | finish := array size. start := anObject identityHash \\ finish. " Search from (hash mod size) to the end. " start to: finish - 1 do: [ :index || element | element := array at: index. (element isNil or: [element key == anObject]) ifTrue: [^index] ]. " Search from start to (hash mod size). " 0 to: start - 1 do: [ :index || element | element := array at: index. (element isNil or: [element key == anObject]) ifTrue: [^index] ]. ^-1 " no match AND no empty slot " ] IdentityDictionary keys [ | keys | keys := IdentitySet new: array size. self keysDo: [:key | keys add: key]. ^keys ]