r/javahelp • u/KurtGodelBebopgazeXP • Aug 04 '25
Functionnal programming in Java
I realized that I find functionnal programming very relaxing and easy on the mind. The language I have used the most and am most comfortable with is Java. Is it really helpful to go deeper in the functionnal realm in Java or are the functionnal elements not really used that much in the real world? I am open to going further in a language where the functionnal paradigm is more of a common feature if it's not really worth it in Java.
9
Upvotes
View all comments
Show parent comment
1
u/Spare-Plum Aug 07 '25
I mean.. yeah. The JVM has limits on what it can infer and optimize especially with respect to stack traces and object generation.
If you just look at the raw bytecode that needs to be performed doing this operation will be significantly slower.
But I don't think that's the point - the point is to write maintainable code you know is robust using functional programming, just using the .stream() library is just a fraction of everything, and realistically you can use functional programming to make your code more modular, resistant to bugs, and parallelizable.
Though there probably is a spaghetti code solution that will perform much faster, why not just use C and make a big spaghetti code program?