Created
May 12, 2021 07:39
-
-
Save gauravkukade/eafc65547cd3cd54877ca5d54eec8acc to your computer and use it in GitHub Desktop.
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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