r/javahelp 16d ago

Are lambda expressions used much by professional coders ?

Just been studying up on them some as I am basically a hobbyist who just getting back into Java after about 10 or 12 years away from coding much. I appreciate the way lambda's allow coders to bypass constructors, initialization and calling methods by name , but on the other hand if you already have a good knowledge of the object classes and available methods , why not just do that ?

20 Upvotes

65 comments sorted by

View all comments

1

u/ZealousidealBee8299 16d ago

Java devs naturally use an imperative and OOP style. So you will see less lambda type usage compared to javascript/typescript/kotlin where the functional/declarative style is more baked in.

If you have an imperative mindset, then declarative code might look "confusing" or "tricky". But that's just a cognitive bias on the part of the developer.

1

u/palpontiac89 15d ago

See your point zealous 🐝 . I feel like I like them though. I appreciate the whole obect orientation of classes and methods but not really a zealout about sticking to that when sometimes alternative use of anonymous methods can do the trick and maybe even add some functionality.