Handle iteration manually, by defining your own implementation of Iterable.
手动处理遍历,定义自己的Iterable实现。
But, just like Iterable, the Enum class is not present in the JDK 1.4 class library.
但是,同iterable一样,在JD K 1.4类库中也没有enum类。
And, just like Iterable and Enum, the valueOf methods are not present in the JDK 1.4 class library.
而且,就像Iterable和Enum一样,value Of方法在JD K 1.4类库中也不存在。
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)的集合类。
Actually, this enhancement works with any object that implements the Iterable interface, not just Collections.
实际上,这个增强适用于实现Iterable接口的任何对象,而不仅仅是Collections。
The reduce method is passed an Iterable whose type will be the type of the (key, value) pairs that are input to it.
对reduce方法传递一个iterable值,它的类型将是输入它的(key, value)对的类型。
The enhanced for loop (also sometimes known as "for-each" loop) can be used for collections that implement the Iterable interface and for arrays.
改进for循环(有时被称为“for - each”循环)能够用于实现了iterable接口的集合类及数组中。
As you can see, though, it takes a lot more to implement the Iterable interface manually than simply extending a class that does this work for you.
但是,您可以看到,与扩展一个现成的类来完成同样的工作相比,手动实现Iterable接口需要做的工作多得多。
For cases where the child collection is obvious and apparent, however, Iterable makes programming against the domain type much easier and more obvious.
但是,如果孩子集合比较明显,Iterable可以使针对域类型的编程更容易,更直观。
The csv.writer method produces a CSV file from an iterable object; cursor.fetchall() is a bit of a beast, and four lines are enough to produce the CSV output.
writer 方法从一个可迭代的对象生成一个 CSV 文件;cursor.fetchall() 功能强大,4 个代码行就足以生成 CSV 输出。
Anything that provides an Iterable facility (technically a trait in Scala, but think of it for now as an interface) can be used as the heart of the for expression.
提供Iterable功能(从技术上说,它是Scala中的一个特征,但现在将它视为一个接口)的任何东西都可以用作for表达式的核心。
Using Iterable has some obvious drawbacks when domain modeling, because only one such collection of objects can be so "implicitly" supported via the iterator method.
在域建模的时候,使用Iterable有一些明显的缺陷,因为通过iterator方法只能那么“隐晦”地支持一个那样的对象集合。