Safe Navigation in Groovy

The ?’s in Groovy confused me, here is the explanation:

Safe navigation

If you are walking a complex object graph and don’t want to have NullPointerExceptions thrown you can use the ?. operator rather than . to perform your navigation.

def foo = null
def bar = foo?.something?.myMethod()
assert bar == null