Groovy web console

subscribe to the feed Subscribe
to this
site

Untitled

Published 2 months ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def map = [foo:'bar', baz:[1,2,3]]
def map2 = map.clone()

map2['baz'] << 99

println(map)
println(map2)

map2['baz'] = map2['baz'] + [5,6,7]

println(map)
println(map2)


/*
[foo:bar, baz:[1, 2, 3, 99]] 
[foo:bar, baz:[1, 2, 3, 99]] 
[foo:bar, baz:[1, 2, 3, 99]] 
[foo:bar, baz:[1, 2, 3, 99, 5, 6, 7]]
*/