Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between NSIndexSet and NSSet?

I'm a bit new to Cocoa and I was reading about NSIndexSet. Why is it necessary? It seems to me that NSIndexSet is nothing but a NSSet of integers, is that right? What's the purpose of creating a separate collection alltogether?

like image 920
Tony Avatar asked Dec 19 '11 00:12

Tony


1 Answers

There are a couple reasons:

  1. NSIndexSet stores unsigned integer primitive types, whereas NSSet stores objects.
  2. NSIndexSet is optimized for storing unsigned integers, specifically a set of integers into another data structure like an NSArray.
like image 167
mipadi Avatar answered Nov 21 '22 22:11

mipadi