Groovy web console

subscribe to the feed Subscribe
to this
site

Closure with Parameter

Published 2 months ago by Babar with tags Groovy Closure Parameter
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def loadPPs(generateKey) {
    def x = [a : 'name', b : 'category', c : 'Genre']
    
    println('key : ' + generateKey(x))
}


def generateKey = { prod -> prod.a + '-' + prod.b }

loadPPs(generateKey)