1

我想遍历存储在任意数据结构中的数据集合。我唯一的接口是Iterable。StringTemplate 可以做到这一点吗?

<source:{e|e.stuff}>



class Source<HasStuff> implements Iterable<HasStuff> {
   // Implementation
}
4

1 回答 1

1

The current release (4.0.7) supports Iterator, but not Iterable. For details, see the following method, which returns an Iterator for use in the mapping operation.

https://github.com/antlr/stringtemplate4/blob/4.0.7/src/org/stringtemplate/v4/Interpreter.java#L1112-L1132

于 2014-01-16T21:59:06.260 回答