4 ms·
The difference is readability and developer efficiency. the non-lambda version in the example is four times the size of the lambda version. I don't know about
by bickfordb 14y ago
The difference is readability and developer efficiency. the non-lambda version in the example is four times the size of the lambda version. I don't know about you, but I can only fit about thirty lines of source code in my brain at once.
Virtually every other modern programming language has a lambda, it's good to see Java catch up. This isn't about Java versus any particular language.
- majormajor 14y agoWhen it comes to how much code you can keep in your head, do you really keep the boilerplate there? Whenever I've used Java and had to attach an ActionListener or whatever, I don't think of it as being an anonymous class with a single method, I think of it as just the logic in the method when I'm reasoning about the program. It is a pain to write if you don't like having to let the IDE do everything for you, though.