Groovy web console

subscribe to the feed Subscribe
to this
site

Viva YO

Published 2 months ago by yO with tags CLOSURE
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
Closure zipCode = { return "no city"  }
 Map<String, Closure> strategies = [            
    "city": { return "city"}       
].withDefault{zipCode}


 Closure getPackConfigFromZipcodeClosure = strategies.get("city_a")
println getPackConfigFromZipcodeClosure.call()