增强循环

Java 5 特性 模式:

//数组
for ( Type type : array) {
}

//列表
for (Object o: List) {
}

原理:

  1. 列表内部是使用Iterable来遍历;
  2. 数组使用下表来遍历

results matching ""

    No results matching ""