@ParameterizedTest @ArgumentsSource(TestCaseArgumentsProvider.class) @TestCase({"empty", "empty", "empty"}) @TestCase({"1", "empty", "1"}) @TestCase({"empty", "2", "2"}) @TestCase({"1", "2", "1"}) void or(Optional<Integer> a, Optional<Integer> b, Optional<Integer> expected) { Optional<Integer> result = OptionalUtil.or(a, b); assertThat(result, is(expected)); }
public static <T> Optional<T> or(Optional<T> optional, Optional<T> other) { return optional.isPresent() ? optional : other; }
OptionalUtil extends UtilityClass { public static <T> Optional<T> or(Optional<T> optional, Optional<T> other) { return optional.isPresent() ? optional : other; } }
OptionalUtil extends UtilityClass { public static <T> Optional<T> or(Optional<T> optional, Optional<T> other) { return optional.isPresent() ? optional : other; }  }
OptionalUtil extends UtilityClass { public static <T> Optional<T> or(Optional<T> optional, Optional<T> other) { return optional.isPresent() ? optional : other; }  static Optional<T> ofBlankable(T s); static Optional<T> ofOnly(Iterable<T> iterable); static OptionalWrapper<T> with(Optional<T> optional); static Optional<T> or(Optional<T> optional, Optional<T> other); static Optional<T> orGet(Optional<T> optional, Supplier<? extends Optional<? extends T>> supplier); static Optional<U> as(Class<U> targetClass, Optional<T> source); @SuppressWarnings("unchecked") static Optional<U> as(TypeToken<U> targetType, Optional<T> source); static Optional<U> as(Class<U> targetClass, T source); @SuppressWarnings("unchecked") static Optional<U> as(TypeToken<U> targetType, T source); }
OptionalUtil extends UtilityClass { public static <T> Optional<T> or(Optional<T> optional, Optional<T> other) { return optional.isPresent() ? optional : other; }  static Optional<T> ofBlankable(T s); static Optional<T> ofOnly(Iterable<T> iterable); static OptionalWrapper<T> with(Optional<T> optional); static Optional<T> or(Optional<T> optional, Optional<T> other); static Optional<T> orGet(Optional<T> optional, Supplier<? extends Optional<? extends T>> supplier); static Optional<U> as(Class<U> targetClass, Optional<T> source); @SuppressWarnings("unchecked") static Optional<U> as(TypeToken<U> targetType, Optional<T> source); static Optional<U> as(Class<U> targetClass, T source); @SuppressWarnings("unchecked") static Optional<U> as(TypeToken<U> targetType, T source);  }