NSArray *arr = @[@111,@222,@111];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
for (NSNumber *number in arr) {
[dict setObject:number forKey:number];
}
NSLog(@"%@",[dict allValues]);
輸出結果爲:
2013-05-21 12:03:49.449 test1[4377:c07] (
111,
222
)
NSArray *arr = @[@111,@222,@111];
NSSet *set = [NSSet setWithArray:arr];
NSLog(@"%@",[set allObjects]);
輸出結果爲:
2013-05-21 12:06:26.508 test1[4547:c07] (
111,
222
)