[ 
https://issues.apache.org/jira/browse/VELOCITY-921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17284151#comment-17284151
 ] 

Claude Brisson commented on VELOCITY-921:
-----------------------------------------

It hasn't been discussed so far. I would let it open for now as a reminder...

> Add syntactic sugar for maps handling in #foreach
> -------------------------------------------------
>
>                 Key: VELOCITY-921
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-921
>             Project: Velocity
>          Issue Type: New Feature
>          Components: Engine
>    Affects Versions: 2.2
>            Reporter: Claude Brisson
>            Assignee: Claude Brisson
>            Priority: Major
>
> `#foreach($x in $map)  defaults to iterating on map values. But what if we 
> have to iterate on keys or on entries? Resorting to write #foreach($k in 
> $map.keySet()) or #foreach($e in $map.entrySet()) always bothered me. Most of 
> the time with maps, we'll want to iterate over keys or entries.
> The proposal is to introduce optional postfixed modifiers in the #foreach 
> syntax, as follow:
> #foreach($k in $map entries)
> #foreach($k in $map keys)
> #foreach($k in $map values)
> the default being kept on values, as it is today. Applying the modifiers on 
> anything else than a map would give an error.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to