NSArray+CommonExtension.h
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// NSArray+CommonExtension.h
// BBAFoundation
//
// Created by Zhu,Yusong on 2018/9/24.
// Copyright © 2018年 Baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BDPFoundationDefines.h"
/*
* 数组 通用扩展
* 详细介绍请看README-CommonExtension
*/
@interface NSArray (CommonExtension)
/**
* @brief 遍历当前数组的每个元素,为该元素映射成一个新的对象
*
* @param mapBlock 映射block,传入原数组的每个元素,返回该元素映射的新对象
* @return 存储所有新对象的数组
*/
- (NSArray *)bba_map:(id(^)(id))mapBlock BDP_FOUNDATION_DEPRECATED("please use bdp_map:");
- (NSArray *)bdp_map:(id(^)(id))mapBlock;
/**
* @brief 遍历当前数组的每个元素,过滤不符合规则的元素
*
* @param filterBlock 过滤block,return NO 表示过滤
* @return 存储符合规则没有被过滤对象的数组
*/
- (NSArray *)bba_filter:(BOOL(^)(id))filterBlock BDP_FOUNDATION_DEPRECATED("please use bdp_filter:");
- (NSArray *)bdp_filter:(BOOL(^)(id))filterBlock;
@end