[groovy] small fix in iteration over a map

This commit is contained in:
Kamil Łopuszański 2017-10-04 16:15:38 +02:00
parent c7036d6e89
commit 9afd4fd1bd
5 changed files with 15 additions and 5 deletions

View File

@ -233,10 +233,12 @@ for (i in array) {
//Itera per un mapa //Itera per un mapa
def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy'] def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy']
x = 0 x = ""
for ( e in map ) { for ( e in map ) {
x += e.value x += e.value
x += " "
} }
assert x.equals("Roberto Grails Groovy ")
/* /*
Operadors Operadors

View File

@ -232,10 +232,12 @@ for (i in array) {
// Iterando sobre un mapa // Iterando sobre un mapa
def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy'] def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy']
x = 0 x = ""
for ( e in map ) { for ( e in map ) {
x += e.value x += e.value
x += " "
} }
assert x.equals("Roberto Grails Groovy ")
/* /*
Operadores Operadores

View File

@ -230,10 +230,12 @@ for (i in array) {
//Iterate over a map //Iterate over a map
def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy'] def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy']
x = 0 x = ""
for ( e in map ) { for ( e in map ) {
x += e.value x += e.value
x += " "
} }
assert x.equals("Roberto Grails Groovy ")
/* /*
Operators Operators

View File

@ -226,10 +226,12 @@ for (i in array) {
//Itera sobre um mapa //Itera sobre um mapa
def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy'] def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy']
x = 0 x = ""
for ( e in map ) { for ( e in map ) {
x += e.value x += e.value
x += " "
} }
assert x.equals("Roberto Grails Groovy ")
/* /*
Operadores Operadores

View File

@ -219,10 +219,12 @@ for (i in array) {
// //
def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy'] def map = ['name':'Roberto', 'framework':'Grails', 'language':'Groovy']
x = 0 x = ""
for ( e in map ) { for ( e in map ) {
x += e.value x += e.value
x += " "
} }
assert x.equals("Roberto Grails Groovy ")
/* /*