What’s the best way to remove duplicate indices from an NSIndexSet? For example, say my NSIndexSet looks like this:
[ 1, 3, 3, 6, 7, 12, 12, 12 ]
I want it to look like:
[ 1, 3, 6, 7, 12 ]
What’s the most efficient way to accomplish this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
NSIndexSetcannot possibly contain duplicates. What makes you think you have any?To be more specific, the documentation states
The key point here is the word “unique”, which means it cannot contain duplicates. Attempting to add an index to an index set that’s already present will result in no change.