Java中的闭包7 [英] Closures in Java 7

查看:126
本文介绍了Java中的闭包7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说关闭可以引入下一个Java标准,计划在明年夏天发布。



这种语法是什么样子?



通用是在java 5.这是真的吗?优点和缺点?



(现在我们绝对知道,closures不会被包含在下一个Java版本中)



OR



编辑: http://puredanger.com/tech/2009/11/18/closures-after-all/ :D


$ b .com / mr / entry / rethinking_jdk7



edit3:没有时间失去!: http://blogs.oracle.com/mr/entry/quartet

解决方案

请查看 http:/ /www.javac.info/



看起来像是这样:

  boolean even = {int x => x%2 == 0} .invoke(15); 

其中 {int x = x%2 == 0} 位是闭包。


I have heard that closures could be introduced in the next Java standard that is scheduled to be released somewhere around next summer.

What would this syntax look like?

I read somewhere that introducing closures in java is a bigger change than generic was in java 5. Is this true? pros and cons?

(By now we definitely know that closures not will be included in the next Java release)

OR

edit: http://puredanger.com/tech/2009/11/18/closures-after-all/ :D

edit2: Re-thinking JDK7: http://blogs.oracle.com/mr/entry/rethinking_jdk7

edit3: There’s not a moment to lose!: http://blogs.oracle.com/mr/entry/quartet

解决方案

Have a look at http://www.javac.info/ .

It seems like this is how it would look:

boolean even = { int x => x % 2 == 0 }.invoke(15);

where the { int x => x % 2 == 0 } bit is the closure.

这篇关于Java中的闭包7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆