• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Closures in Java

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OMG! I was frequently ignoring the e-mail about this Java Programming Cookbook promotion until I saw that the author was Herb Schildt. Hehehe.

Anyway, I would like to ask about "Closures". As I have heard, it's going to be(or already is) supported in Java 7? If so, what is it for? How does it help me as a developer? Could you provide an example?

From what I understand, a technical cookbook usually provides some ready-made codes? Is this what the book is about?


Thanks!
 
Herb Schildt
Author
Ranch Hand
Posts: 253
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim:

At this time I can't comment on what might or might not be in Java 7. Its just too early.

As to what's in my cookbook: Yes, there are a lot of code examples, lots of options, and lots of alternatives.

See the book's page on the McGraw-Hill website for the table of contents and Chapter 1.

An example recipe can be found on my website by clicking on the book's title on the homepage. Then, near the end of the book's description is a link to a sample recipe.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Closures may be included in JDK 7, or JDK 8. There are a couple specific proposals for adding closures that are being discussed. Whether, how, and when they get added is yet to be determined. There is a prototype JDK available from Neal Gafter which supports closures. It's still a work in progress, with numerous bugs and bug fixes, and it's not an official Sun JDK. It's just one guy's demonstration of how closures could be implemented. Of course it's one guy who for several years was the primary author of Sun's javac compiler, and the proposal he's been working on is also supported by James Gosling, Gilad Bracha, and Peter von der Ahe. So it's not just one crazy guy in a garage. But ideas for how closures in Java should work are still evolving, and the final form (if there is one) may be somewhat different, and may stil be a few yearrs away. Recall that it took quite awhile for generics to make it into the language - this may be similar.

You may want to see this nice long talk from Neal, and this list of resources.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic