Fix left side in Either of Java Vavr

Viewed 136

I want to avoid:

Either<Error, Employee> processEmployee(Employee e)

and use:

Result<Employee> processEmployee(Employee e)

where left is fixed:

Result<T> extends Either<Error, T>

Is there an example of this?

When I try this nothing compiles for me and I'm forced to implement a concrete class of Result<T> which I want to avoid.

The reason I want to do this is to simplify the method signatures and the stream code that uses these methods.

0 Answers
Related