Created
August 13, 2010 18:53
-
-
Save threeve/523357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface Foo : NSObject | |
@end | |
@interface Bar : NSObject | |
@end | |
@implementation Foo | |
@end | |
@implementation Bar | |
@end | |
int main (int argc, const char * argv[]) | |
{ | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
NSMutableArray *array = [NSMutableArray arrayWithObjects:[Foo new], [Foo new], [Bar new], [Foo new], [Bar new], [Bar new], nil]; | |
NSPredicate *p = [NSPredicate predicateWithFormat:@"self.class == %@", [Foo class]]; | |
NSLog(@"%@\n%@", array, [array filteredArrayUsingPredicate:p]); | |
[pool drain]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment