kar
kar

Reputation: 3651

What does -> means in Java

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.

enter image description here

When I clicked on the method, it reverted back to how I initially wrote it as follows:

enter image description here

My Question is, is this a new syntax for Java 8.0 or did the IDE automatically did some kind of information collapse?

Upvotes: 2

Views: 610

Answers (1)

Bart Kiers
Bart Kiers

Reputation: 170158

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).

EDIT

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.

Upvotes: 4

Related Questions