Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/Collections-Abstract/Collection.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -891,11 +891,17 @@ Collection >> hash [
-- two equal objects have equal hash values"

| hash |

hash := self species hash.
self size <= 10 ifTrue:
[self do: [:elem | hash := hash bitXor: elem hash]].
^hash bitXor: self size hash
self size <= 10 ifTrue: [
| identity elemIdentityHash elemHash |
identity := self identityHash.
self do: [ :elem |
elemIdentityHash := elem identityHash.
elemHash := elemIdentityHash = identity
ifTrue: [ elemIdentityHash ]
ifFalse: [ elem hash ].
hash := hash bitXor: elemHash ] ].
^ hash bitXor: self size hash
]

{ #category : 'testing' }
Expand Down