48. Use block enumeration more and use for loop less

Summary of this article:

1. First, four methods that can be used for traversal are listed: standard C language for loop, NSEnumerator in Objective-C 1.0, for in fast traversal in Objective-C 1.0, and block traversal.

2. For each type of traversal, code examples for NSArray, NSDictionary, and NSSet containers are given, and readers can directly imitate them.

3. For each traversal method, the principle, advantages and disadvantages of the implementation are slightly explained.


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324726330&siteId=291194637