How to create a list inside Freemarker template

freemarker, java

Solution

FreeMarker doesn't support modifying collections. But if you really want to do this in FreeMarker (as opposed to in Java), you can use sequence concatenation: `<#assign myList = myList + [newItem]>`. Here you create a new sequence that wraps the two other sequences. Be aware that the resulting sequence is slow if you try to do indexed access in a long list constructed this way.

Problem

I have a set of functions_names that i generate while iterating a list of values. I want to capture these values "functions_names" in a list and use it for further processing. How can i do that? Thanks

Original source