I would like to iterate over a collection of data stored in an arbitrary data structure. The only interface I have is Iterable. Is this possible with StringTemplate?
<source:{e|e.stuff}>
class Source<HasStuff> implements Iterable<HasStuff> {
// Implementation
}
The current release (4.0.7) supports
Iterator
, but notIterable
. For details, see the following method, which returns anIterator
for use in the mapping operation.https://github.com/antlr/stringtemplate4/blob/4.0.7/src/org/stringtemplate/v4/Interpreter.java#L1112-L1132