Nsset is also a collection that, in combination with arrays, can hold data of the object type as a dictionary.
The set collection cannot hold the same object, its elements are not the same, and they are stored in an unordered order.
Note: The same elements can be stored in the set collection, but the same elements will be left only one after running. As follows:
Nil is not stored in the set set because nil is a set-end flag.
Create a Nsset object
Nsset *Set=[nsset setwithobjects:@"1",@"2",@"1",@"3",@"4",@"2",@"5",@"3", nil];
NSLog (@ "%@",set);
The results of the operation are as follows:
for:53.48110.29. 1 [558:15953] {( 3, 4, 5 , 1 , 2 )}
Common methods of Nsmutableset:
set]; // Create an empty collection Nsmutableset *set2=[nsmutableset setwithcapacity:ten]; [Set1 AddObject: @""]; // adding elements [Set1 removeobject:@ ""]; // Delete Element
Object-c Nsset Type