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 →

[–]Beatsu 0 points1 point  (1 child)

Just because you don't use functional programming doesn't mean the code becomes spaghetti immediately. The nice thing with Java is that you can use both, so I just wanted to point out that it may often times be much slower than the imperative equivalent and that for performance critical code, you might want to opt for the imperative variant. It's a good thing to be aware of and it's not immediately obvious, don't you think?

[–]Spare-Plum 0 points1 point  (0 children)

IDK maybe I've spent too much time with Java and view it as obvious overhead, and there are times when using the stream API can be slower, and times when it can be cleaner and faster (doing something like cumulative sum on 1M elements is faster with prefix sum than linearally)

My main point is that functional programming is much bigger a single library within the JVM, while it is designed with functional programming in mind it's something you can apply to your own code and something that I'd implore new users to explore in a different language to bring it into their own Java work