On Wed, Nov 17, 2010 at 1:15 PM, Christopher Schultz <ch...@christopherschultz.net> wrote: > All, > > I'd like to mutate a collection during template evaluation -- > essentially, I'd like to call Iterator.remove() during a loop. Is that > possible? Does Velocity expose an Iterator or anything like that to the > template?
#set( $iterator = $list.iterator() ) #foreach( $item in $iterator ) #if ($item.isBad() )#set( $null = $iterator.remove() )#end #end > Or, am I forced to iterate over one collection and add to another one? > > For that matter, is there a convenient way of creating an empty > ArrayList or something similar? #set( $list = [] ) > Thanks, > -chris > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org