Sorting List String

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Sorting List String

julia
Hello,
        I want to sort the list String to get ascending order in my thymleaf page. Is there any utility object for that?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Sorting List String

danielfernandez
Administrator
There is no expression utility method for doing collection sorting, but if you are using Spring (and therefore Spring EL in your expressions), you can call the "Collections.sort(..)" method like:

    ${T(java.util.Collections).sort(myCollection)}


Regards,
Daniel.