@Test public void testEqualsTransitive() { final Exceptional<Integer> ten1 = Exceptional.of(tenSupplier); final Exceptional<Integer> ten2 = Exceptional.of(tenSupplier); final Exceptional<Integer> ten3 = Exceptional.of(tenSupplier); assertEquals(ten1, ten2); assertEquals(ten2, ten3); assertEquals(ten1, ten3); }
@NotNull public static <T> Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> supplier) { Objects.requireNonNull(supplier); try { return new Exceptional<T>(supplier.get(), null); } catch (Throwable throwable) { return of(throwable); } }
Exceptional { @NotNull public static <T> Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> supplier) { Objects.requireNonNull(supplier); try { return new Exceptional<T>(supplier.get(), null); } catch (Throwable throwable) { return of(throwable); } } }
Exceptional { @NotNull public static <T> Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> supplier) { Objects.requireNonNull(supplier); try { return new Exceptional<T>(supplier.get(), null); } catch (Throwable throwable) { return of(throwable); } } private  Exceptional(@Nullable T value, @Nullable Throwable throwable); }
Exceptional { @NotNull public static <T> Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> supplier) { Objects.requireNonNull(supplier); try { return new Exceptional<T>(supplier.get(), null); } catch (Throwable throwable) { return of(throwable); } } private  Exceptional(@Nullable T value, @Nullable Throwable throwable); @NotNull static Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> supplier); @NotNull @Contract("_ -> new") static Exceptional<T> of(@NotNull Throwable throwable); @Nullable T get(); boolean isPresent(); @Nullable T getOrElse(@Nullable T other); @Nullable T getOrElse(@NotNull Supplier<? extends T> other); @NotNull Optional<T> getOptional(); @Nullable Throwable getException(); @Nullable T getOrThrow(); @Nullable T getOrThrowRuntimeException(); @Nullable T getOrThrow(@NotNull E exception); @NotNull Exceptional<T> or(@NotNull Supplier<Exceptional<T>> supplier); @Nullable R custom(@NotNull Function<Exceptional<T>, R> function); @NotNull Exceptional<U> map(@NotNull ThrowableFunction<? super T, ? extends U, Throwable> mapper); @NotNull Exceptional<T> ifPresent(@NotNull Consumer<? super T> consumer); @NotNull Exceptional<T> ifException(@NotNull Consumer<Throwable> consumer); @NotNull @SuppressWarnings("unchecked") Exceptional<T> ifExceptionIs(@NotNull Class<E> throwableClass, @NotNull Consumer<? super E> consumer); @NotNull Exceptional<T> recover(@NotNull final ThrowableFunction<Throwable, ? extends T, Throwable> function); @NotNull Exceptional<T> recoverWith(@NotNull final Function<Throwable, ? extends Exceptional<T>> function); @Override boolean equals(Object obj); @Override int hashCode(); @NotNull @Override String toString(); }
Exceptional { @NotNull public static <T> Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> supplier) { Objects.requireNonNull(supplier); try { return new Exceptional<T>(supplier.get(), null); } catch (Throwable throwable) { return of(throwable); } } private  Exceptional(@Nullable T value, @Nullable Throwable throwable); @NotNull static Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> supplier); @NotNull @Contract("_ -> new") static Exceptional<T> of(@NotNull Throwable throwable); @Nullable T get(); boolean isPresent(); @Nullable T getOrElse(@Nullable T other); @Nullable T getOrElse(@NotNull Supplier<? extends T> other); @NotNull Optional<T> getOptional(); @Nullable Throwable getException(); @Nullable T getOrThrow(); @Nullable T getOrThrowRuntimeException(); @Nullable T getOrThrow(@NotNull E exception); @NotNull Exceptional<T> or(@NotNull Supplier<Exceptional<T>> supplier); @Nullable R custom(@NotNull Function<Exceptional<T>, R> function); @NotNull Exceptional<U> map(@NotNull ThrowableFunction<? super T, ? extends U, Throwable> mapper); @NotNull Exceptional<T> ifPresent(@NotNull Consumer<? super T> consumer); @NotNull Exceptional<T> ifException(@NotNull Consumer<Throwable> consumer); @NotNull @SuppressWarnings("unchecked") Exceptional<T> ifExceptionIs(@NotNull Class<E> throwableClass, @NotNull Consumer<? super E> consumer); @NotNull Exceptional<T> recover(@NotNull final ThrowableFunction<Throwable, ? extends T, Throwable> function); @NotNull Exceptional<T> recoverWith(@NotNull final Function<Throwable, ? extends Exceptional<T>> function); @Override boolean equals(Object obj); @Override int hashCode(); @NotNull @Override String toString();  }