banderson623 banderson623 - 1 year ago 127
Groovy Question

How to check if element in groovy array/hash/collection/list?

How do I figure out if an array contains an element?
I thought there might be something like

which would evaluate as

Answer Source

.contains() is the best method for lists, but for maps you will need to use .containsKey() or .containsValue()