@Test public void mapFailureTest() { Try<Integer> failure1 = new Failure<>(exception); Try<Double> failure2 = failure1.map(i -> 1.0); assertSame(failure1, failure2); }
public <F> Try<F> map(Function<E, F> mapper) { return flatMap(of(result -> mapper.apply(result))); }
Try { public <F> Try<F> map(Function<E, F> mapper) { return flatMap(of(result -> mapper.apply(result))); } }
Try { public <F> Try<F> map(Function<E, F> mapper) { return flatMap(of(result -> mapper.apply(result))); }  }
Try { public <F> Try<F> map(Function<E, F> mapper) { return flatMap(of(result -> mapper.apply(result))); }  static Function<I, Try<O>> of(ThrowingFunction<I, O> function); static Function<I, Supplier<Try<O>>> lazyOf(ThrowingFunction<I, O> function); static Collector<Try<E>, ?, Map<Type, List<Try<E>>>> groupingBySuccess(); static TryCollector<E> collect(); abstract Type getType(); boolean isSuccess(); boolean isFailure(); Try<F> map(Function<E, F> mapper); Try<O> flatMap(Function<E, Try<O>> mapper); Optional<E> toOption(); E getOrThrow(); void ifPresent(Consumer<E> consumer); Success<E> asSuccess(); Failure<E> asFailure(); }
Try { public <F> Try<F> map(Function<E, F> mapper) { return flatMap(of(result -> mapper.apply(result))); }  static Function<I, Try<O>> of(ThrowingFunction<I, O> function); static Function<I, Supplier<Try<O>>> lazyOf(ThrowingFunction<I, O> function); static Collector<Try<E>, ?, Map<Type, List<Try<E>>>> groupingBySuccess(); static TryCollector<E> collect(); abstract Type getType(); boolean isSuccess(); boolean isFailure(); Try<F> map(Function<E, F> mapper); Try<O> flatMap(Function<E, Try<O>> mapper); Optional<E> toOption(); E getOrThrow(); void ifPresent(Consumer<E> consumer); Success<E> asSuccess(); Failure<E> asFailure();  }