I want to find a specific key in a given map. If the key is found, I then want to get the value of that key from the map.
This is what I managed so far:
The reason you get a Null Pointer Exception is because there is no key likesZZZ in your second example. Try:
def mymap = [name:"Gromit", likes:"cheese", id:1234] def x = mymap.find{ it.key == "likes" }.value if(x) println "x value: ${x}"