Skip to content
Closed
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
17 changes: 13 additions & 4 deletions ReStore/SSWDBOwnedCollectionSpec.cls
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,21 @@ deleteQuery
yourself!

elementsIn: aCollection notIn: anotherCollection

^aCollection reject: [ :each | anotherCollection identityIncludes: each]!
| testAgainst |
"For small collections, the IdentitySet is actually slower, so just stick with the original collection in that common case."
testAgainst := anotherCollection size < 10
ifTrue: [anotherCollection]
ifFalse: [anotherCollection asIdentitySet].
^aCollection reject: [:each | testAgainst identityIncludes: each].!

hasCollection: updatedCollection anyAdditionsOrRemovalsFrom: originalCollection

^updatedCollection size ~= originalCollection size or: [updatedCollection anySatisfy: [ :each | (originalCollection identityIncludes: each) not]]!
| testAgainst |
updatedCollection size = originalCollection size ifFalse: [^true].
"For small collections, the IdentitySet is actually slower, so just stick with the original collection in that common case."
testAgainst := originalCollection size < 10
ifTrue: [originalCollection]
ifFalse: [originalCollection asIdentitySet].
^updatedCollection anySatisfy: [:each | (testAgainst identityIncludes: each) not].!

orderingSpecs

Expand Down