The question is as simple as the title. How to check in Groovy that object is a list or collection or array? But can\'t find a simple way of checking it. Any ideas?
A List is a Collection, so the checks aren't mutually exclusive:
List
Collection
def foo = ... boolean isCollection = foo instanceof Collection boolean isList = foo instanceof List boolean isSet = foo instanceof Set boolean isArray = foo != null && foo.getClass().isArray()