Campbell Ritchie wrote:But the idea was to show a λ in use.
I think this thread might well be duplicated in the Java8 forum.
Yes, it does that. I am clearly not as comfortable with Java 8 features as many. However, my objection is not about what code you write to accomplish a task. For my own part, simple, easy-to-understand code is superior to complex/cryptic syntax, but I digress.
However, my essential point initially was that Java is supposed to be object-oriented. As far as I can see, lambda expressions don't belong to any class. They are indeed more like a C function embedded in Java code. I think the object-oriented paradigm is a good one. Lambdas are not OO. They are not a member of a clss I defined. They are not methods of a class I defined. At least anonymous inner classes, though inelegant, are classes. It is not far from creating a Singleton, Final Static class, Final Static method. However, that, at least, is a class from which an object is instantiated (I think). Do lambda expressions cause an object to be instantiated?My objection is primarily, though not exclusively, conceptual, not syntactical. I will be interested to see what this looks like in a stack trace because it does not belong to anything I instantiate, if I understand lambdas correctly. I will learn them because they are now part of Java, but I don't think they should be.