@Test public void isPresentSuccessTest() { AtomicInteger atomicInteger = new AtomicInteger(0); Success<AtomicInteger> success = new Success<>(atomicInteger); success.ifPresent(input -> input.incrementAndGet()); assertEquals(1, success.getResult().get()); }
public void ifPresent(Consumer<E> consumer) { if(isSuccess()) { consumer.accept(asSuccess().getResult()); } }
Try { public void ifPresent(Consumer<E> consumer) { if(isSuccess()) { consumer.accept(asSuccess().getResult()); } } }
Try { public void ifPresent(Consumer<E> consumer) { if(isSuccess()) { consumer.accept(asSuccess().getResult()); } }  }
Try { public void ifPresent(Consumer<E> consumer) { if(isSuccess()) { consumer.accept(asSuccess().getResult()); } }  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 void ifPresent(Consumer<E> consumer) { if(isSuccess()) { consumer.accept(asSuccess().getResult()); } }  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();  }