@Test public void shouldReturnAMapperThatMapsAnEitherToItsRight() throws Exception { Integer expected = 100; Either<String, Integer> either = Either.right(100); Mapper<? super Either<String, Integer>, Integer> mapper = Eithers.toRight(); Integer actual = mapper.map(either); assertThat(actual, is(expected)); }
public static <S, T> Mapper<? super Either<S, T>, T> toRight() { return new Mapper<Either<S, T>, T>(){ @Override public T map(Either<S, T> either) { return either.getRight(); } }; }
Eithers { public static <S, T> Mapper<? super Either<S, T>, T> toRight() { return new Mapper<Either<S, T>, T>(){ @Override public T map(Either<S, T> either) { return either.getRight(); } }; } }
Eithers { public static <S, T> Mapper<? super Either<S, T>, T> toRight() { return new Mapper<Either<S, T>, T>(){ @Override public T map(Either<S, T> either) { return either.getRight(); } }; } private  Eithers(); }
Eithers { public static <S, T> Mapper<? super Either<S, T>, T> toRight() { return new Mapper<Either<S, T>, T>(){ @Override public T map(Either<S, T> either) { return either.getRight(); } }; } private  Eithers(); static Iterable<T> rights(Iterable<Either<S, T>> eithers); static Iterable<S> lefts(Iterable<Either<S, T>> eithers); static Mapper<? super Either<S, T>, T> toRight(); static Mapper<? super Either<S, T>, S> toLeft(); static Predicate<? super Either<S, T>> isRight(); static Predicate<? super Either<S, T>> isLeft(); }
Eithers { public static <S, T> Mapper<? super Either<S, T>, T> toRight() { return new Mapper<Either<S, T>, T>(){ @Override public T map(Either<S, T> either) { return either.getRight(); } }; } private  Eithers(); static Iterable<T> rights(Iterable<Either<S, T>> eithers); static Iterable<S> lefts(Iterable<Either<S, T>> eithers); static Mapper<? super Either<S, T>, T> toRight(); static Mapper<? super Either<S, T>, S> toLeft(); static Predicate<? super Either<S, T>> isRight(); static Predicate<? super Either<S, T>> isLeft();  }