What do you mean by closures?

devquora
devquora

Posted On: Feb 22, 2018

 

A closure is a short and anonymous block of code which is just used to span a few lines of code. This block of code can even be entered as a parameter in the method. Closures are anonymous in nature. Formal parameters can also be contained in closures so that it can be more useful just like methods in groovy. Closures can also refer to a variable at the time when a closure is defined. Closures can be a type of parameter for a method. Few methods provided by closure itself are listed below:
  • find()
  • findAll()
  • any() and every()
  • Collect (), etc.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Java Grails Interview Questions

    What are the best practices to be followed while developing a grails application?

    Building an application using grails framework is quite easy. But, when building it the right way we need to follow the..

    Java Grails Interview Questions

    What do you mean by scaffolding? How do we use it?

    Scaffolding is used to generate some basic CRUD interfaces for a domain class. It includes the necessary views and some..

    Java Grails Interview Questions

    What is the use of bootstrap.groovy?

    Sometimes a situation occurs in which a particular task is to be carried out every time the application starts or stops..