freemarker.template
Class FastIterator

java.lang.Object
  extended by 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 1101 2013-04-01 04:17:32Z run2000 $
See Also:
FastList

Field Summary
protected  java.util.Iterator<? extends TemplateModel> iterator
          The iterator being wrapped by this model.
 
Constructor Summary
FastIterator(java.util.Collection<? extends TemplateModel> 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
 

Field Detail

iterator

protected final java.util.Iterator<? extends TemplateModel> iterator
The iterator being wrapped by this model.

Constructor Detail

FastIterator

public FastIterator(java.util.Collection<? extends TemplateModel> collection)
Constructor that takes a java.util.Collection implementation to iterator over.

Throws:
java.lang.NullPointerException - the collection is null
Method Detail

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
Throws:
TemplateModelException