Home »
Code Examples »
Groovy Code Examples
Groovy - Check if element in groovy array/hash/collection/list Code Example
Here is the solution for "Check if element in groovy array/hash/collection/list" in Groovy.
Groovy code for Check if element in groovy array/hash/collection/list
// To check an element in a list the .contains()
// is the best method.
// To check an elements in a map use .containsKey()/ .containsValue() method.
[a:1,b:2,c:3].containsValue(3)
[a:1,b:2,c:3].containsKey('a')
Code by IncludeHelp,
on March 13, 2023 22:43