我们都知道这段代码:
ArrayList<String> str1 = new ArrayList<String>();
for(String str: str1) {
// code goes here
}
Run Code Online (Sandbox Code Playgroud)
这个增强型for循环使用Iterable而不是Iterator遍历.但我没有看到ArrayList延伸Iterable.谁能告诉我为什么会发生这种情况?
| 归档时间: |
|
| 查看次数: |
8629 次 |
| 最近记录: |