How to iterate over a map in mvel
问题 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? 回答1: 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); } 来源: https://stackoverflow.com