什么 - >用Java表示 [英] What does -> means in Java
问题描述
我只想了解符号' - >'的含义。我写了一个简单的方法并关闭了IDE会话。当我回来继续我的工作时,它看起来如下。
I am just looking to get an understanding on what the symbol '->' means. I wrote a simple method and closed that IDE session. When I returned back to continue my work, it looked as follows.
当我点击该方法时,它又回复到我最初的编写方式,如下所示:
When I clicked on the method, it reverted back to how I initially wrote it as follows:
我的问题是,这是Java的新语法8.0或IDE是否自动完成某种信息崩溃?
My Question is, is this a new syntax for Java 8.0 or did the IDE automatically did some kind of information collapse?
推荐答案
它是Java的8 Lambda表达式,但是因为我看到 (查看) - >
灰显了一下,可能是你的IDE折叠了。检查:设置
,编辑
,代码折叠
然后取消选中Closures(实现单一方法的匿名类)
。
It is either Java's 8 Lambda Expressions, but since I see the (view) ->
grayed out a bit, it is probably folded by your IDE. Check: Settings
, Editor
, Code Folding
and then uncheck "Closures" (anonymous classes implementing a single method)
.
是的,我检查了IntelliJ 13.我安装了JDK 7(我的系统上没有v8),并检查设置
,编辑
,代码折叠
然后取消选中Closures(实现单个方法的匿名类)
使它们看起来与原始问题中的图片完全相同。
Yes, I checked IntelliJ 13. I have JDK 7 installed (I don't have v8 on my system), and checking Settings
, Editor
, Code Folding
and then uncheck "Closures" (anonymous classes implementing a single method)
makes them look exactly like the picture in the original question.
这篇关于什么 - >用Java表示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!