Just to add some more insight, the “?:” operator is known as the binary operator or commonly referred to as the elvis operator. The following code examples all produce the same results where x evaluates to true according to Groovy Truth
// These three code snippets mean the same thing.
// If x is true according to groovy truth return x else return y
x ?: y
x ? x : y // Standard ternary operator.
if (x) {
return x
} else {
return y
}
Click here for more info on Elvis Operator