Search code examples
quarkusquarkus-qute

Render first element of set using quarkus qute template engine


While trying to render first element of set using quarkus qute template engine it is throwing the below xception.

io.quarkus.qute.TemplateException: Rendering error in template [index.html] line 93: Property "0" not found on the base object "java.util.LinkedHashSet" in expression {appDetails.imageUrls.0}

Code used to render

<img src="{appDetails.imageUrls[0]}" />

Solution

  • Since as mentioned in the error imageUrls is of type Set. So use iterator().next() method to get the first element.

     <img src="{appDetails.imageUrls.iterator().next()}" />