public interface TemplateCollectionModel extends TemplateModel
TemplateSequenceModel
, and
implementations of that interface needn't also implement this interface just because they can. They should though, if
enumeration with this interface is significantly faster than enumeration by index. The #list
directive will
enumerate using this interface if it's available.
The enumeration should be repeatable if that's possible with reasonable effort, otherwise a second enumeration
attempt is allowed to throw an TemplateModelException
. Generally, the interface user Java code need not
handle that kind of exception, as in practice only the template author can handle it, by not listing such collections
twice.
Note that to wrap Java's Collection
, you should implement TemplateCollectionModelEx
, not just this
interface.
NOTHING
Modifier and Type | Method and Description |
---|---|
TemplateModelIterator |
iterator()
Retrieves a template model iterator that is used to iterate over the elements in this collection.
|
TemplateModelIterator iterator() throws TemplateModelException
TemplateModelException