Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef NSInteger (^ib_enum_bool_t)(id);
- typedef id (^ib_enum_id_t)(id);
- - (void)deleteIf:(ib_enum_bool_t)blk {
- for (NSInteger i = (self.count - 1); i >= 0; --i) {
- if (blk([self objectAtIndex:i])) {
- [self removeObjectAtIndex:i];
- }
- }
- }
- - (NSArray *)map:(ib_enum_id_t)blk {
- NSMutableArray *mappedArray = [NSMutableArray array];
- for (NSInteger i = (self.count - 1); i >= 0; --i) {
- [mappedArray unshiftObject:blk([self objectAtIndex:i])];
- }
- return mappedArray;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement