Handle iteration manually, by defining your own implementation of Iterable.
手动处理遍历,定义自己的Iterable实现。
Trying to get an Iterator on a Map fails at compile time — Maps don't implement the Iterable interface.
在编译时,尝试对 Map 获取 Iterator 会导致失败 — Map 并没有实现 Iterable 接口。
Extend an existing collection class that already implements Iterable (and therefore already supports for/in).
扩展现有的、已经实现了 Iterable(因此也就已经支持 for/in)的集合类。
应用推荐