Products Downloads


French version


 

This function adds a value to a sequence.

The sequence may have been created by the "createArrayList" function.

The sequence passed as a parameter is changed directly: the value is added to the end of the sequence.

 

N.B: Adding a value to a sequence created literally is not allowed as there is a risk of causing side effects during successive template executions:

<#assign emptySeq = []/>
<#assign noUse = hardisCore.addToSequence(emptySeq, 1) />
emptySeq size:${emptySeq?size} 
If this fragment of code is kept in a cache by FreeMarker, the emptySeq size will be 2 on the second execution. The place needs to be written:
<#assign emptySeq = hardisCore.createArrayList() />
<#assign noUse = hardisCore.addToSequence(emptySeq, 1) />
emptySeq size:${emptySeq?size}

 

Parameters

Sequence

seqValues

Sequence to change

Mandatory

All types

value

Value to be added to the end of the sequence

Mandatory

 


For example

<#assign newSeq = hardisCore.createArrayList() />
<#assign noUse = hardisCore.addToSequence(emptySeq, true) />
<#assign noUse = hardisCore.addToSequence(emptySeq, .now?date) />
<#assign noUse = hardisCore.addToSequence(emptySeq, [1, 2, 3]) />
emptySeq size:${emptySeq?size}

↑ Top of page