admin
2022-09-04 fa05f89529e05078b29606e4beda3de5cfdce485
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
//  NSMutableArray+Utilities.h
//  BUAdSDK
//
//  Created by 李盛 on 2018/2/28.
//  Copyright © 2018年 bytedance. All rights reserved.
//
 
#import <Foundation/Foundation.h>
 
NS_ASSUME_NONNULL_BEGIN
 
@interface NSMutableArray (BU_Utilities)
 
- (void)bu_safeAddObject:(id)object;
- (void)bu_safeAddNilObject;
- (void)bu_safeInsertObject:(id)object atIndex:(NSUInteger)index;
- (void)bu_safeInsertObjects:(NSArray *)objects atIndexes:(NSIndexSet *)indexes;
- (void)bu_safeRemoveObject:(id)object;
- (nullable id)bu_objectAtIndexSafely:(NSUInteger)index;
- (void)bu_removeObjectAtIndexSafely:(NSUInteger)index;
 
 
 
 
 
 
@end
 
@interface NSArray(BU_JSONValue)
- (nullable NSString *)bu_JSONRepresentation:(NSError **)error;
 
 
 
- (void)bu_forEachWithBlock:(void(^)(id item))block;
- (void)bu_forEachWithIndexBlock:(void(^)(id item, NSInteger index))indexBlock;
 
- (NSArray *)bu_mapWithBlock:(id(^)(id item))block;
- (NSArray *)bu_mapWithIndexBlock:(id(^)(id item, NSInteger index))indexBlock;
 
- (NSArray *)bu_filterWithConditionBlock:(BOOL(^)(id item))conditionBlock;
- (NSArray *)bu_filterWithIndexConditionBlock:(BOOL(^)(id item, NSInteger index))indexConditionBlock;
 
- (BOOL)bu_someWithConditionBlock:(BOOL(^)(id item))conditionBlock;
- (BOOL)bu_someWithIndexConditionBlock:(BOOL(^)(id item, NSInteger index))indexConditionBlock;
 
- (BOOL)bu_everyWithConditionBlock:(BOOL(^)(id item))conditionBlock;
- (BOOL)bu_everyWithIndexConditionBlock:(BOOL(^)(id item, NSInteger index))indexConditionBlock;
 
- (id)bu_reduceWithBlock:(id(^)(id item1, id item2))block initial:(id)initial;
 
 
 
- (id)bu_findWithConditionBlock:(id(^)(id item))conditionBlock;
- (id)bu_findWithIndexConditionBlock:(id(^)(id item, NSInteger index))indexConditionBlock;
@end
 
NS_ASSUME_NONNULL_END