blob: bea7885e9b418449a1129b0cb00d4786f24e0a5b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_281) on Sun Jan 15 15:58:35 CET 2023 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SimpleSequence (FreeMarker 2.3.32 API)</title>
<meta name="date" content="2023-01-15">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SimpleSequence (FreeMarker 2.3.32 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":42,"i1":10,"i2":10,"i3":10,"i4":10,"i5":42,"i6":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SimpleSequence.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../freemarker/template/SimpleScalar.html" title="class in freemarker.template"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../freemarker/template/Template.html" title="class in freemarker.template"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?freemarker/template/SimpleSequence.html" target="_top">Frames</a></li>
<li><a href="SimpleSequence.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">freemarker.template</div>
<h2 title="Class SimpleSequence" class="title">Class SimpleSequence</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../freemarker/template/WrappingTemplateModel.html" title="class in freemarker.template">freemarker.template.WrappingTemplateModel</a></li>
<li>
<ul class="inheritance">
<li>freemarker.template.SimpleSequence</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a>, <a href="../../freemarker/template/TemplateSequenceModel.html" title="interface in freemarker.template">TemplateSequenceModel</a>, java.io.Serializable</dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../freemarker/template/SimpleList.html" title="class in freemarker.template">SimpleList</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">SimpleSequence</span>
extends <a href="../../freemarker/template/WrappingTemplateModel.html" title="class in freemarker.template">WrappingTemplateModel</a>
implements <a href="../../freemarker/template/TemplateSequenceModel.html" title="interface in freemarker.template">TemplateSequenceModel</a>, java.io.Serializable</pre>
<div class="block">A simple implementation of the <a href="../../freemarker/template/TemplateSequenceModel.html" title="interface in freemarker.template"><code>TemplateSequenceModel</code></a> interface, using its own underlying <code>List</code> for
storing the list items. If you are wrapping an already existing <code>List</code> or <code>array</code>, you should certainly
use <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> or <a href="../../freemarker/template/DefaultArrayAdapter.html" title="class in freemarker.template"><code>DefaultArrayAdapter</code></a> (see comparison below).
<p>
This class is thread-safe if you don't call modifying methods (like <a href="../../freemarker/template/SimpleSequence.html#add-java.lang.Object-"><code>add(Object)</code></a>) after you have made the
object available for multiple threads (assuming you have published it safely to the other threads; see JSR-133 Java
Memory Model). These methods aren't called by FreeMarker, so it's usually not a concern.
<p>
<b><a href="../../freemarker/template/SimpleSequence.html" title="class in freemarker.template"><code>SimpleSequence</code></a> VS <a href="../../freemarker/template/DefaultListAdapter.html" title="class in freemarker.template"><code>DefaultListAdapter</code></a>/<a href="../../freemarker/template/DefaultArrayAdapter.html" title="class in freemarker.template"><code>DefaultArrayAdapter</code></a> - Which to use when?</b>
</p>
<p>
For a <code>List</code> or <code>array</code> that exists regardless of FreeMarker, only you need to access it from templates,
<a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> should be the default choice, as it can be unwrapped to the originally wrapped object
(important when passing it to Java methods from the template). It also has more predictable performance (no spikes).
<p>
For a sequence that's made specifically to be used from templates, creating an empty <a href="../../freemarker/template/SimpleSequence.html" title="class in freemarker.template"><code>SimpleSequence</code></a> then
filling it with <a href="../../freemarker/template/SimpleSequence.html#add-java.lang.Object-"><code>add(Object)</code></a> is usually the way to go, as the resulting sequence is
significantly faster to read from templates than a <a href="../../freemarker/template/DefaultListAdapter.html" title="class in freemarker.template"><code>DefaultListAdapter</code></a> (though it's somewhat slower to read
from a plain Java method to which it had to be passed adapted to a <code>List</code>).
<p>
It also matters if for how many times will the <em>same</em> <code>List</code> entry be read from the template(s) later,
on average. If, on average, you read each entry for more than 4 times, <a href="../../freemarker/template/SimpleSequence.html" title="class in freemarker.template"><code>SimpleSequence</code></a> will be most
certainly faster, but if for 2 times or less (and especially if not at all) then <a href="../../freemarker/template/DefaultMapAdapter.html" title="class in freemarker.template"><code>DefaultMapAdapter</code></a> will
be faster. Before choosing based on performance though, pay attention to the behavioral differences;
<a href="../../freemarker/template/SimpleSequence.html" title="class in freemarker.template"><code>SimpleSequence</code></a> will shallow-copy the original <code>List</code> at construction time, so it won't reflect
<code>List</code> content changes after the <a href="../../freemarker/template/SimpleSequence.html" title="class in freemarker.template"><code>SimpleSequence</code></a> construction, also <a href="../../freemarker/template/SimpleSequence.html" title="class in freemarker.template"><code>SimpleSequence</code></a> can't be
unwrapped to the original wrapped instance.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../freemarker/template/DefaultListAdapter.html" title="class in freemarker.template"><code>DefaultListAdapter</code></a>,
<a href="../../freemarker/template/DefaultArrayAdapter.html" title="class in freemarker.template"><code>DefaultArrayAdapter</code></a>,
<a href="../../freemarker/template/TemplateSequenceModel.html" title="interface in freemarker.template"><code>TemplateSequenceModel</code></a>,
<a href="../../serialized-form.html#freemarker.template.SimpleSequence">Serialized Form</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected java.util.List</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#list">list</a></span></code>
<div class="block">The <code>List</code> that stored the elements of this sequence.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.freemarker.template.TemplateModel">
<!-- -->
</a>
<h3>Fields inherited from interface&nbsp;freemarker.template.<a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a></h3>
<code><a href="../../freemarker/template/TemplateModel.html#NOTHING">NOTHING</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#SimpleSequence--">SimpleSequence</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">Use <a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-freemarker.template.ObjectWrapper-"><code>SimpleSequence(ObjectWrapper)</code></a> instead.</span></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-java.util.Collection-">SimpleSequence</a></span>(java.util.Collection&nbsp;collection)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">Use <a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-java.util.Collection-freemarker.template.ObjectWrapper-"><code>SimpleSequence(Collection, ObjectWrapper)</code></a>.</span></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-java.util.Collection-freemarker.template.ObjectWrapper-">SimpleSequence</a></span>(java.util.Collection&nbsp;collection,
<a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a>&nbsp;wrapper)</code>
<div class="block">Constructs a simple sequence that will contain the elements from the specified <code>Collection</code>; consider
using <a href="../../freemarker/template/DefaultListAdapter.html" title="class in freemarker.template"><code>DefaultListAdapter</code></a> instead.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-int-">SimpleSequence</a></span>(int&nbsp;capacity)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">Use <a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-int-freemarker.template.ObjectWrapper-"><code>SimpleSequence(int, ObjectWrapper)</code></a>.</span></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-int-freemarker.template.ObjectWrapper-">SimpleSequence</a></span>(int&nbsp;capacity,
<a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a>&nbsp;wrapper)</code>
<div class="block">Constructs an empty simple sequence with preallocated capacity.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-freemarker.template.ObjectWrapper-">SimpleSequence</a></span>(<a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a>&nbsp;wrapper)</code>
<div class="block">Constructs an empty sequence using the specified object wrapper.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-freemarker.template.TemplateCollectionModel-">SimpleSequence</a></span>(<a href="../../freemarker/template/TemplateCollectionModel.html" title="interface in freemarker.template">TemplateCollectionModel</a>&nbsp;tcm)</code>
<div class="block">Constructs a simple sequence from the passed collection model, which shouldn't be added to later.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#add-boolean-">add</a></span>(boolean&nbsp;b)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">Use <a href="../../freemarker/template/SimpleSequence.html#add-java.lang.Object-"><code>add(Object)</code></a> instead, as this bypasses the <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a>.</span></div>
</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#add-java.lang.Object-">add</a></span>(java.lang.Object&nbsp;obj)</code>
<div class="block">Adds an arbitrary object to the end of this sequence.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#get-int-">get</a></span>(int&nbsp;index)</code>
<div class="block">Returns the item at the specified index of the list.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#size--">size</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../freemarker/template/SimpleSequence.html" title="class in freemarker.template">SimpleSequence</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#synchronizedWrapper--">synchronizedWrapper</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>java.util.List</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#toList--">toList</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">No replacement exists; not a reliable way of getting back the original list elemnts.</span></div>
</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../freemarker/template/SimpleSequence.html#toString--">toString</a></span>()</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.freemarker.template.WrappingTemplateModel">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;freemarker.template.<a href="../../freemarker/template/WrappingTemplateModel.html" title="class in freemarker.template">WrappingTemplateModel</a></h3>
<code><a href="../../freemarker/template/WrappingTemplateModel.html#getDefaultObjectWrapper--">getDefaultObjectWrapper</a>, <a href="../../freemarker/template/WrappingTemplateModel.html#getObjectWrapper--">getObjectWrapper</a>, <a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-">setDefaultObjectWrapper</a>, <a href="../../freemarker/template/WrappingTemplateModel.html#setObjectWrapper-freemarker.template.ObjectWrapper-">setObjectWrapper</a>, <a href="../../freemarker/template/WrappingTemplateModel.html#wrap-java.lang.Object-">wrap</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="list">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>list</h4>
<pre>protected final&nbsp;java.util.List list</pre>
<div class="block">The <code>List</code> that stored the elements of this sequence. It migth contains both <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> elements
and non-<a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> elements.</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="SimpleSequence--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SimpleSequence</h4>
<pre>@Deprecated
public&nbsp;SimpleSequence()</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">Use <a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-freemarker.template.ObjectWrapper-"><code>SimpleSequence(ObjectWrapper)</code></a> instead.</span></div>
<div class="block">Constructs an empty simple sequence that will use the the default object
wrapper set in
<a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-"><code>WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper)</code></a>.</div>
</li>
</ul>
<a name="SimpleSequence-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SimpleSequence</h4>
<pre>@Deprecated
public&nbsp;SimpleSequence(int&nbsp;capacity)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">Use <a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-int-freemarker.template.ObjectWrapper-"><code>SimpleSequence(int, ObjectWrapper)</code></a>.</span></div>
<div class="block">Constructs an empty simple sequence with preallocated capacity and using
the default object wrapper set in
<a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-"><code>WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper)</code></a>.</div>
</li>
</ul>
<a name="SimpleSequence-java.util.Collection-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SimpleSequence</h4>
<pre>@Deprecated
public&nbsp;SimpleSequence(java.util.Collection&nbsp;collection)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">Use <a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-java.util.Collection-freemarker.template.ObjectWrapper-"><code>SimpleSequence(Collection, ObjectWrapper)</code></a>.</span></div>
<div class="block">Constructs a simple sequence that will contain the elements
from the specified <code>Collection</code> and will use the the default
object wrapper set in
<a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-"><code>WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>collection</code> - the collection containing initial values. Note that a
copy of the collection is made for internal use.</dd>
</dl>
</li>
</ul>
<a name="SimpleSequence-freemarker.template.TemplateCollectionModel-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SimpleSequence</h4>
<pre>public&nbsp;SimpleSequence(<a href="../../freemarker/template/TemplateCollectionModel.html" title="interface in freemarker.template">TemplateCollectionModel</a>&nbsp;tcm)
throws <a href="../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre>
<div class="block">Constructs a simple sequence from the passed collection model, which shouldn't be added to later. The internal
list will be build immediately (not lazily). The resulting sequence shouldn't be extended with
<a href="../../freemarker/template/SimpleSequence.html#add-java.lang.Object-"><code>add(Object)</code></a>, because the appropriate <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a> won't be available; use
<a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-java.util.Collection-freemarker.template.ObjectWrapper-"><code>SimpleSequence(Collection, ObjectWrapper)</code></a> instead, if you need that.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code></dd>
</dl>
</li>
</ul>
<a name="SimpleSequence-freemarker.template.ObjectWrapper-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SimpleSequence</h4>
<pre>public&nbsp;SimpleSequence(<a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a>&nbsp;wrapper)</pre>
<div class="block">Constructs an empty sequence using the specified object wrapper.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>wrapper</code> - The object wrapper to use to wrap the list items into <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> instances. <code>null</code> is
allowed, but deprecated, and will cause the deprecated default object wrapper (set in
<a href="../../freemarker/template/WrappingTemplateModel.html#setDefaultObjectWrapper-freemarker.template.ObjectWrapper-"><code>WrappingTemplateModel.setDefaultObjectWrapper(ObjectWrapper)</code></a>) to be used.</dd>
</dl>
</li>
</ul>
<a name="SimpleSequence-int-freemarker.template.ObjectWrapper-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SimpleSequence</h4>
<pre>public&nbsp;SimpleSequence(int&nbsp;capacity,
<a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a>&nbsp;wrapper)</pre>
<div class="block">Constructs an empty simple sequence with preallocated capacity.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>wrapper</code> - See the similar parameter of <a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-freemarker.template.ObjectWrapper-"><code>SimpleSequence(ObjectWrapper)</code></a>.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>2.3.21</dd>
</dl>
</li>
</ul>
<a name="SimpleSequence-java.util.Collection-freemarker.template.ObjectWrapper-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SimpleSequence</h4>
<pre>public&nbsp;SimpleSequence(java.util.Collection&nbsp;collection,
<a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template">ObjectWrapper</a>&nbsp;wrapper)</pre>
<div class="block">Constructs a simple sequence that will contain the elements from the specified <code>Collection</code>; consider
using <a href="../../freemarker/template/DefaultListAdapter.html" title="class in freemarker.template"><code>DefaultListAdapter</code></a> instead.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>collection</code> - The collection containing the initial items of the sequence. A shallow copy of this collection is made
immediately for internal use (thus, later modification on the parameter collection won't be visible in
the resulting sequence). The items however, will be only wrapped with the <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a>
lazily, when first needed.</dd>
<dd><code>wrapper</code> - See the similar parameter of <a href="../../freemarker/template/SimpleSequence.html#SimpleSequence-freemarker.template.ObjectWrapper-"><code>SimpleSequence(ObjectWrapper)</code></a>.</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="add-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>public&nbsp;void&nbsp;add(java.lang.Object&nbsp;obj)</pre>
<div class="block">Adds an arbitrary object to the end of this sequence. If the newly added object does not implement the
<a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> interface, it will be wrapped into the appropriate <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a> interface when
it's first read (lazily).</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>obj</code> - The object to be added.</dd>
</dl>
</li>
</ul>
<a name="add-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>@Deprecated
public&nbsp;void&nbsp;add(boolean&nbsp;b)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">Use <a href="../../freemarker/template/SimpleSequence.html#add-java.lang.Object-"><code>add(Object)</code></a> instead, as this bypasses the <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a>.</span></div>
<div class="block">Adds a boolean value to the end of this sequence. The newly added boolean will be immediately converted into
<a href="../../freemarker/template/TemplateBooleanModel.html#TRUE"><code>TemplateBooleanModel.TRUE</code></a> or <a href="../../freemarker/template/TemplateBooleanModel.html#FALSE"><code>TemplateBooleanModel.FALSE</code></a>, without using the <a href="../../freemarker/template/ObjectWrapper.html" title="interface in freemarker.template"><code>ObjectWrapper</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - The boolean value to be added.</dd>
</dl>
</li>
</ul>
<a name="toList--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toList</h4>
<pre>@Deprecated
public&nbsp;java.util.List&nbsp;toList()
throws <a href="../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">No replacement exists; not a reliable way of getting back the original list elemnts.</span></div>
<div class="block">Builds a deep-copy of the underlying list, unwrapping any values that were already converted to
<a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>-s. When called for the second time (or later), it just reuses the first result, unless the
sequence was modified since then.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code></dd>
</dl>
</li>
</ul>
<a name="get-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public&nbsp;<a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template">TemplateModel</a>&nbsp;get(int&nbsp;index)
throws <a href="../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></pre>
<div class="block">Returns the item at the specified index of the list. If the item isn't yet an <a href="../../freemarker/template/TemplateModel.html" title="interface in freemarker.template"><code>TemplateModel</code></a>, it will wrap
it to one now, and writes it back into the backing list.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../freemarker/template/TemplateSequenceModel.html#get-int-">get</a></code>&nbsp;in interface&nbsp;<code><a href="../../freemarker/template/TemplateSequenceModel.html" title="interface in freemarker.template">TemplateSequenceModel</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the item at the specified index, or <code>null</code> if the index is out of bounds. Note that a
<code>null</code> value is interpreted by FreeMarker as "variable does not exist", and accessing a
missing variables is usually considered as an error in the FreeMarker Template Language, so the usage of
a bad index will not remain hidden, unless the default value for that case was also specified in the
template.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../freemarker/template/TemplateModelException.html" title="class in freemarker.template">TemplateModelException</a></code></dd>
</dl>
</li>
</ul>
<a name="size--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>size</h4>
<pre>public&nbsp;int&nbsp;size()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../freemarker/template/TemplateSequenceModel.html#size--">size</a></code>&nbsp;in interface&nbsp;<code><a href="../../freemarker/template/TemplateSequenceModel.html" title="interface in freemarker.template">TemplateSequenceModel</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the number of items in the list.</dd>
</dl>
</li>
</ul>
<a name="synchronizedWrapper--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>synchronizedWrapper</h4>
<pre>public&nbsp;<a href="../../freemarker/template/SimpleSequence.html" title="class in freemarker.template">SimpleSequence</a>&nbsp;synchronizedWrapper()</pre>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a synchronized wrapper for list.</dd>
</dl>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;java.lang.String&nbsp;toString()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/SimpleSequence.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../freemarker/template/SimpleScalar.html" title="class in freemarker.template"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../freemarker/template/Template.html" title="class in freemarker.template"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?freemarker/template/SimpleSequence.html" target="_top">Frames</a></li>
<li><a href="SimpleSequence.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>