mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Remove array and dictionary literals
This commit is contained in:
parent
4f2cb0672c
commit
cb05d93167
1 changed files with 5 additions and 1 deletions
|
@ -6,11 +6,15 @@
|
|||
|
||||
int main(void) {
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSDictionary *dict1, *dict2;
|
||||
NSArray *array, *filtered;
|
||||
NSPredicate *predicate;
|
||||
|
||||
dict1 = [NSDictionary dictionaryWithObject:@"value1" forKey:@"key"];
|
||||
dict2 = [NSDictionary dictionaryWithObject:@"value2" forKey:@"key"];
|
||||
array = [NSArray arrayWithObjects:dict1, dict2, [NSNull null], nil];
|
||||
|
||||
// Basic filtering with NSPredicate
|
||||
array = @[@{@"key": @"value1"}, @{@"key": @"value2"}, [NSNull null]];
|
||||
predicate = [NSPredicate predicateWithFormat:@"key == %@", @"value2"];
|
||||
filtered = [array filteredArrayUsingPredicate: predicate];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue