mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +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) {
|
int main(void) {
|
||||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||||
|
NSDictionary *dict1, *dict2;
|
||||||
NSArray *array, *filtered;
|
NSArray *array, *filtered;
|
||||||
NSPredicate *predicate;
|
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
|
// Basic filtering with NSPredicate
|
||||||
array = @[@{@"key": @"value1"}, @{@"key": @"value2"}, [NSNull null]];
|
|
||||||
predicate = [NSPredicate predicateWithFormat:@"key == %@", @"value2"];
|
predicate = [NSPredicate predicateWithFormat:@"key == %@", @"value2"];
|
||||||
filtered = [array filteredArrayUsingPredicate: predicate];
|
filtered = [array filteredArrayUsingPredicate: predicate];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue