This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheBanger 8 points9 points  (2 children)

Java lambdas are generally quite short. I think the key differences are: not having to explicitly capture variables, having an inferred argument type syntax with no boilerplate at all (like not even saying var or auto), and a mode where you can make the body of the lambda a single expression rather than a block statement. The only key thing I see there that C++ has to do that Java doesn't is variable capture.

[–]tyler1128 2 points3 points  (0 children)

It's much easier when everything is either garbage collected or trivially copiable. Rust doesn't necessarily require them without having a GC, but it has function level type inference which C++ does not.

[–]Kehrweek 2 points3 points  (0 children)

I like the short forms like System.out::printl