문제

I have 2 NSSet's, say SetA and SetB.

SetA has 3 objects. SetA = @[ObjectA, ObjectB, ObjectC];

SetB has 4 objects. SetB = @[ObjectA, ObjectC, ObjectD, ObjectE];

I wish to find out which objects of SetA are missing in SetB. One way I can do it is by iterating over every object in SetA and finding it in SetB.

Question - Is there a quicker way to achieve this in which I don't have to iterate over the entire set. The sets are dynamically populated.

도움이 되었습니까?

해결책

Use NSMutableSet and minusSet to remove elements in another set. The difference is what you're looking for.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top