DEV Community

Discussion on: Let's talk about STREAMS !!

Collapse
 
thorstenhirsch profile image
Thorsten Hirsch

Hi Abhinava, I'm glad someone's writing about Java and FP. Doesn't seem to be a popular combination on dev.to ...or anywhere. 🤣

I've only started to work again with Java recently and couldn't find much besides streams that I can use for FP in Java. So my programs are still very OO-ish, and I can only make use of streams in some methods. But what about enforcing immutability? What about currying? And monads? I know there are libraries like vavr.io that implement these things for Java, but I haven't touched them, yet. Do you know such libraries? I'm afraid there might be a heavy performance impact when using such libraries.

Collapse
 
the_unconventional_coder profile image
ABHINAVA GHOSH (he/him)

Using FP in monads for example is not very common , and as far as i have experienced Streams are the only widespread use of FP in JAVA currently.And its not bcoz of performance issues but bcoz there are better alternatives to it.

Collapse
 
aleksandarskrbic profile image
Aleksandar Skrbic

Most you can get from Vavr is some mix of OOP and FP and it works great. It's probably the best FPish library for Java. Pure FP is not possible in Java, like in Scala with ZIO, Cats-Effect, and Monix.
I wrote a blog about FP in Java and Vavr, if you are interested here is the link: aleksandarskrbic.github.io/a-taste...

Some comments have been hidden by the post's author - find out more