@Test public void right() throws Exception { assertEquals(new Long(666L), Either.left(233).map(integer -> integer + 433L, Object::hashCode)); }
public static <L, R> Either<L, R> right(R r) { return new Either<L, R>() { @Override public <T> T map(Function1<L, T> lt, Function1<R, T> rt) { return rt.invoke(r); } @Override @SuppressWarnings("unchecked") public boolean equals(Object rhs) { return canEqual(rhs) && ((Either<L, R>) rhs).map(ll -> false, r::equals); } }; }
Either implements Equals { public static <L, R> Either<L, R> right(R r) { return new Either<L, R>() { @Override public <T> T map(Function1<L, T> lt, Function1<R, T> rt) { return rt.invoke(r); } @Override @SuppressWarnings("unchecked") public boolean equals(Object rhs) { return canEqual(rhs) && ((Either<L, R>) rhs).map(ll -> false, r::equals); } }; } }
Either implements Equals { public static <L, R> Either<L, R> right(R r) { return new Either<L, R>() { @Override public <T> T map(Function1<L, T> lt, Function1<R, T> rt) { return rt.invoke(r); } @Override @SuppressWarnings("unchecked") public boolean equals(Object rhs) { return canEqual(rhs) && ((Either<L, R>) rhs).map(ll -> false, r::equals); } }; } private  Either(); }
Either implements Equals { public static <L, R> Either<L, R> right(R r) { return new Either<L, R>() { @Override public <T> T map(Function1<L, T> lt, Function1<R, T> rt) { return rt.invoke(r); } @Override @SuppressWarnings("unchecked") public boolean equals(Object rhs) { return canEqual(rhs) && ((Either<L, R>) rhs).map(ll -> false, r::equals); } }; } private  Either(); abstract T map(Function1<L, T> lt, Function1<R, T> rt); static Either<L, R> left(L l); static Either<L, R> right(R r); @Override boolean canEqual(Object that); }
Either implements Equals { public static <L, R> Either<L, R> right(R r) { return new Either<L, R>() { @Override public <T> T map(Function1<L, T> lt, Function1<R, T> rt) { return rt.invoke(r); } @Override @SuppressWarnings("unchecked") public boolean equals(Object rhs) { return canEqual(rhs) && ((Either<L, R>) rhs).map(ll -> false, r::equals); } }; } private  Either(); abstract T map(Function1<L, T> lt, Function1<R, T> rt); static Either<L, R> left(L l); static Either<L, R> right(R r); @Override boolean canEqual(Object that);  }