Assuming I have a defined class
class MyClass {
}
Is there a hit in performance in runtime in doing def c = new MyClass() instead of MyClass c = new MyClass()? Or is it exactly the same?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
defis a replacement for a type name. In variable definitions it is used to indicate that you don’t care about the type.If you don’t declare the type of variable, Groovy under the covers will be declared as type
Object. You can think ofdefas an alias ofObject.In your example: