I'm trying to create a list of elements, but the elements may be added if they satisfy their given conditions, for example :
<\div th:with = "$list = { {[condition1] ? [value1 if true] : null, [condition2] ? [value2 if true] : null } }">
What is intended is that, the size will vary depending on each conditions for the elements, so that list could either have 2 or 1 or no element at all. However, thymeleaf treats null as an element too, so I don't know if there is a way to instruct the engine to literally 'not add' when condition is false.