Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Injecting attributes from a map
- void set( map ) {
- // Does something with each of the values
- for (entry in map) {
- println "${entry.key} : ${entry.value}"
- }
- }
- // Plain old Java
- java.util.LinkedHashMap m = new java.util.LinkedHashMap();
- m.put("a","Alpha");
- m.put("b","Bravo");
- set(m);
- // The same in Groovy
- set( a:"Alpha" ,
- b:"Bravo" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement