| A simple implementation of
TemplateCollectionModel .
It's able to wrap java.util.Iterator-s and java.util.Collection-s.
If you wrap an Iterator, the variable can be <list>-ed (<forach>-ed) only once!
Consider using
SimpleSequence instead of this class if you want to wrap Iterators.
SimpleSequence will read all elements of the Iterator, and store them in a List
(this may cause too high resource consumption in some applications), so you can list the variable
for unlimited times. Also, if you want to wrap Collections, and then list the resulting
variable for many times, SimpleSequence may gives better performance, as the
wrapping of non-TemplateModel objects happens only once.
This class is thread-safe. The returned TemplateModelIterator-s
are not thread-safe.
version: $Id: SimpleCollection.java,v 1.13 2004/11/27 14:49:57 ddekany Exp $ |