Can we have Either class in Java languare?
Владимир Шумихин
androiden3201 at gmail.com
Fri Apr 5 19:46:23 UTC 2019
Thank you for the clarification.
пт, 5 апр. 2019 г. в 22:37, Brian Goetz <brian.goetz at oracle.com>:
> The motivation for Optional was not so much that we wanted to provide the
> One Official Maybe Monad for Java (in fact, this was the worst part of
> doing Optional); it was that the JDK APIs needed a better way to indicate a
> possibly-empty return value. Since I think the chance is about zero that
> JDK APIs will migrate from exceptions to Either, this motivation will not
> be carrying Either into the JDK any time soon…..
>
>
> > On Apr 5, 2019, at 3:03 PM, Владимир Шумихин <androiden3201 at gmail.com>
> wrote:
> >
> > 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