0

I have a collection (map) which I want to use with the foreach orb tag.

How do i do this in mvel and is it also possible to get the current key?

Farouk Alhassan
  • 3,780
  • 9
  • 51
  • 74

1 Answers1

4
Map<Integer, Integer> map = new HashMap<Integer, Integer>();

//java
for (Map.Entry<Integer, Integer> entry : map.entrySet()) 
{
    System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}

//mvel
foreach (c : map.entrySet) 
{

   System.out.println("Key = " +c.key + ", Value = " +c.value);
}
Nomad
  • 1,092
  • 11
  • 29
  • 42