@Test public void orUsesValue() { assertThat(OptionalUtils.or(Optional.of("Kevin"), () -> Optional.of("foo")).get(), equalTo("Kevin")); }
@SuppressWarnings("unchecked") public static <T> Optional<T> or(Optional<T> value, Supplier<Optional<? extends T>> supplier) { return value.isPresent() ? value : (Optional<T>) supplier.get(); }
OptionalUtils { @SuppressWarnings("unchecked") public static <T> Optional<T> or(Optional<T> value, Supplier<Optional<? extends T>> supplier) { return value.isPresent() ? value : (Optional<T>) supplier.get(); } }
OptionalUtils { @SuppressWarnings("unchecked") public static <T> Optional<T> or(Optional<T> value, Supplier<Optional<? extends T>> supplier) { return value.isPresent() ? value : (Optional<T>) supplier.get(); } private  OptionalUtils(); }
OptionalUtils { @SuppressWarnings("unchecked") public static <T> Optional<T> or(Optional<T> value, Supplier<Optional<? extends T>> supplier) { return value.isPresent() ? value : (Optional<T>) supplier.get(); } private  OptionalUtils(); @SuppressWarnings("unchecked") static Optional<T> or(Optional<T> value, Supplier<Optional<? extends T>> supplier); static Stream<T> stream(Optional<T> value); static void ifPresentOrElse(Optional<T> value, Consumer<T> action, Runnable emptyAction); }
OptionalUtils { @SuppressWarnings("unchecked") public static <T> Optional<T> or(Optional<T> value, Supplier<Optional<? extends T>> supplier) { return value.isPresent() ? value : (Optional<T>) supplier.get(); } private  OptionalUtils(); @SuppressWarnings("unchecked") static Optional<T> or(Optional<T> value, Supplier<Optional<? extends T>> supplier); static Stream<T> stream(Optional<T> value); static void ifPresentOrElse(Optional<T> value, Consumer<T> action, Runnable emptyAction);  }