The groovy way to see if something is in a list is to use \"in\"
if(\'b\' in [\'a\',\'b\',\'c\'])
However how do you nicely see if something
Regarding one of the original answers:
if (!['a', 'b', 'c'].contains('b'))
Somebody mentioned that it is easy to miss the ! because it's far from the method call. This can be solved by assigning the boolean result to a variable and just negate the variable.
def present = ['a', 'b', 'c'].contains('b')
if (!present) {
// do stuff
}