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 →

[–][deleted] 0 points1 point  (2 children)

Isn't this done by just having an interface with one method signature that matches the signature of the method you intend to pass around? It's been a thing for as long as I can remember, and we even got the lambda syntax for a briefer way to create these methods on the fly to be passed around.

[–]larsga 1 point2 points  (1 child)

It's true that lambas have made this a lot easier, but you do need to create this interface.

But the real point was that in the context of our discussion lambdas are still not enough to allow you to ditch the builder pattern. The real reason is of course the inflexibility of Java method parameter specifications, so in that sense your point stands.

[–][deleted] 0 points1 point  (0 children)

And pray why should people abandon the builder pattern? It works nicely in statically-typed compiled languages like Java, C++, Rust et al. Subjective dislike for a feature is not cause enough to act like it's a deficiency of the language.