Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
If you want to check if an object implements a particular interface or extends a particular class (e.g. String, ArrayList, etc), you can use the `instanceof` keyword. check blogpost at https://coderolls.com/determine-a-datatype-in-groovy/
//If you want to check if an object implements a particular interface or extends a particular class (e.g. String, ArrayList, etc), you can use the `instanceof` keyword.
// check blogpost https://coderolls.com/determine-a-datatype-in-groovy/
def blogname = '''coderolls''';
println (blogname instanceof String) // true
println (blogname instanceof ArrayList) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment