Can we have Either class in Java languare?
Владимир Шумихин
androiden3201 at gmail.com
Fri Apr 5 19:03:07 UTC 2019
Hello,
Java 8 has introduced a new class Optional -
https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html This is
an incredibly useful tool that allows us to avoid NullPointerException.
There is another very attractive monad. I'm talking about
Either monad/class. This tool allows us to explicitly handle errors without
using checked exceptions.
There are multiple implementations Either in 3-d party libraries:
1) http://www.vavr.io/vavr-docs/#_either
2) http://www.functionaljava.org/
3)
https://bitbucket.org/atlassian/fugue/src/b0868a00273f8f2ccf5d1a2610a8a5507ce641c4/fugue/src/main/java/com/atlassian/fugue/Either.java?at=master&fileviewer=file-view-default
So, there is one problem with 3-d party libraries. We have multiple
implementations Either in classpath of applications, but we have to convert
one Either to another one.
Is there any chance that we will have Either in Java SE?
Thank you for response.
More information about the amber-dev
mailing list