How can I modify sequences (lists) and hashes (maps) in FreeMarker templates?
First of all, you may don’t want to modify the sequence/hash, just concatenate (add) two or more of them, which results in a new sequence/hash, rather than modifying an existing one. In this case use the sequence concatenation and hash concatenation operators. Also, you may use the subsequence operator instead of removing sequence items. However, be aware of the performance implications: these operations are fast, but the hashes/sequences that are the result of many subseqent applications of these operations (i.e. when you use the result of the operation as the input of yet another operation, and so on) will be slow to read. Now if you still want to modify sequences/hashes, then read on… The FreeMarkes Template Language doesn’t support the modification of sequences/hashes. It’s for displaying already calculated things, not for calculating data. Keep templates simple. But don’t give it up, you will see some advices and tricks bellow. The best is if you can divide the work between the