title: How to sort List in Strintemplate (v4)?
body: <p>Here is what I try to achieve:</p>
  <p>In my Java code, at some place a Map (may be a HashMap) is created, that may not be sorted:</p>
  <pre class="lang-java prettyprint-override"><code>var map = Map.of(&quot;c&quot;,&quot;third entry&quot;,&quot;a&quot;,&quot;first entry&quot;,&quot;b&quot;,&quot;second entry&quot;);
  var data = Map.of(&quot;map&quot;,map);
  </code></pre>
  <p>Later this map is passed to a stringtemplate loaded from a file with content similar to this:</p>
  <pre><code>delimiters &quot;«&quot;, &quot;»&quot;
  template(data) ::= &lt;&lt;
  
  «data.map.keys:{key|• «data.map.(key)»}; separator=&quot;\n&quot;» 
  &gt;&gt;
  </code></pre>
  <p>However, I want the generated list to be sorted by map key, but there seems to be no function like <code>sort(list)</code>. Can I achieve what I want?</p>
  <p>desired:</p>
  <pre><code>«sorted(data.map.keys):{key|• «data.map.(key)»}; separator=&quot;\n&quot;» 
  </code></pre>
  <p>I googled for this functionality for some time and I really wonder, whether nobody had wanted sorted lists before.
  Of course, I could solve it by passing an extra (sorted) list of keys. But is there a straightforward approach?</p>
  <p>best wishes :)</p>