freemarker.template
Class FastIterator
java.lang.Object
|
+--freemarker.template.FastIterator
- All Implemented Interfaces:
- TemplateIteratorModel, TemplateModel
- Direct Known Subclasses:
- ExtendedIterator
- public class FastIterator
- extends java.lang.Object
- implements TemplateIteratorModel
Iterator class for FastList
. Note that this model is not
serializable, to match the semantics of the underlying java.util.Iterator
.
- Since:
- 1.8
- Version:
- $Id: FastIterator.java,v 1.6 2003/11/27 07:38:49 run2000 Exp $
- See Also:
FastList
Field Summary |
protected java.util.Iterator |
iterator
The iterator being wrapped by this model. |
Constructor Summary |
FastIterator(java.util.Collection collection)
Constructor that takes a java.util.Collection implementation
to iterator over. |
Method Summary |
boolean |
hasNext()
Do we have another item in the list? |
boolean |
isEmpty()
Is the object empty? |
TemplateModel |
next()
Retrieve the next item in the list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
iterator
protected final java.util.Iterator iterator
- The iterator being wrapped by this model.
FastIterator
public FastIterator(java.util.Collection collection)
- Constructor that takes a
java.util.Collection
implementation
to iterator over.
- Throws:
NullPointerException
- the collection is null
hasNext
public boolean hasNext()
throws TemplateModelException
- Do we have another item in the list?
- Specified by:
hasNext
in interface TemplateIteratorModel
- Returns:
true
if there are more items to be iterated over,
otherwise false
- Throws:
TemplateModelException
- there was a problem determining the
next item in the list
next
public TemplateModel next()
throws TemplateModelException
- Retrieve the next item in the list. The item will be a
TemplateModel
containing the underlying value.
- Specified by:
next
in interface TemplateIteratorModel
- Returns:
- the next item in the list
- Throws:
TemplateModelException
- the next item couldn't be retrieved,
or we're at the end of the list
isEmpty
public boolean isEmpty()
throws TemplateModelException
- Is the object empty?
- Specified by:
isEmpty
in interface TemplateModel
- Returns:
true
if this object is empty, otherwise false