Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT and Closures

Tags:

closures

gwt

I have used closures concept in javascript many times. I am new to GWT and I read somewhere it is not possible to use Closures in GWT. Is my understanding wrong or will I able to use it? Can someone provide me an example of closure use in GWT.


1 Answers

The equivalent of closures in Java are local classes, which can be anonymous (just like anonymous functions in JS).
Java 8 will bring us lambdas, but GWT isn't yet supporting Java 7, so lambdas in GWT are not for tomorrow ;-)

See http://en.wikipedia.org/wiki/Closure_(computer_science)#Local_classes_.28Java.29

like image 70
Thomas Broyer Avatar answered Mar 03 '26 13:03

Thomas Broyer