NSMUtableSet 使用如下:
#import "MS_NSMutableSet.h"
@implementation MS_NSMutableSet
@synthesize _nsMutableSet;
-(void)showMutableSet
{
_nsMutableSet = [NSMutableSet setWithCapacity:0];
for(int i=0;i<6;i++)
{
[_nsMutableSet addObject:[NSString stringWithFormat:@"A%i",i]];
}
for(id item in _nsMutableSet)
{
NSLog(@"Mutable Set Item:%@",item);
}
[_nsMutableSet removeObject:@"A0"];
for(id item in _nsMutableSet)
{
NSLog(@"Mutable Set List Item:%@",item);
}
NSArray *array1 = [[NSArray alloc] initWithObjects:@"A",@"B",@"C", nil];
[_nsMutableSet addObjectsFromArray:array1];
for(id item in _nsMutableSet)
{
NSLog(@"addForArray:%@",item);
}
NSLog(@"mutableSet count %lu",_nsMutableSet.count);
[_nsMutableSet removeAllObjects];
NSLog(@"mutableSet count %lu",_nsMutableSet.count);
}
@end