Associative array/Creation: Difference between revisions

m
Line 1,082:
// remove an entry
map.remove( "Scott" )
// loop and maps
for( entry in map.entrySet() ) {
print("Key: ${entry.Key}, Value: ${entry.Value}")
}
 
// functional iteration
map.eachKey(\ k ->print(map[k]) )
map.eachValue(\ v ->print(v))
map.eachKeyAndValue(\ k, v -> print("Key: ${v}, Value: ${v}"))