loopVar = it.next();
hasNext = it.hasNext();
put(iteratorBlock.getIndexName(), loopVar);
TemplateBooleanModel hasNextModel = hasNext ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
put(iteratorBlock.getIndexName() + "_has_next", hasNextModel);
put(iteratorBlock.getIndexName() + "_index", new SimpleNumber(index));
TemplateElement nestedBlock = iteratorBlock.getNestedBlock();
if (nestedBlock != null) {
env.render(nestedBlock);
}
index++;
}
}
else if (list instanceof TemplateSequenceModel) {
TemplateSequenceModel tsm = (TemplateSequenceModel) list;
int size = tsm.size();
for (index =0; index <size; index++) {
clear();
loopVar = tsm.get(index);
put(iteratorBlock.getIndexName(), loopVar);
hasNext = (size > index + 1);
TemplateBooleanModel hasNextModel = (size > index +1) ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
put(iteratorBlock.getIndexName() + "_has_next", hasNextModel);
put(iteratorBlock.getIndexName() + "_index", new SimpleNumber(index));
TemplateElement nestedBlock = iteratorBlock.getNestedBlock();
if (nestedBlock != null) {
env.render(nestedBlock);
}
}