@Test public void testMap() { final BooleanPredicate negate = BooleanPredicate.Util.negate(BooleanPredicate.Util.identity()); OptionalBoolean result; result = OptionalBoolean.empty().map(negate); assertThat(result, isEmpty()); result = OptionalBoolean.of(true).map(negate); assertThat(result, hasValue(false)); result = OptionalBoolean.of(false).map(negate); assertThat(result, hasValue(true)); }
@NotNull public OptionalBoolean map(@NotNull BooleanPredicate mapper) { if (!isPresent()) { return empty(); } Objects.requireNonNull(mapper); return OptionalBoolean.of(mapper.test(value)); }
OptionalBoolean { @NotNull public OptionalBoolean map(@NotNull BooleanPredicate mapper) { if (!isPresent()) { return empty(); } Objects.requireNonNull(mapper); return OptionalBoolean.of(mapper.test(value)); } }
OptionalBoolean { @NotNull public OptionalBoolean map(@NotNull BooleanPredicate mapper) { if (!isPresent()) { return empty(); } Objects.requireNonNull(mapper); return OptionalBoolean.of(mapper.test(value)); } private  OptionalBoolean(); private  OptionalBoolean(boolean value); }
OptionalBoolean { @NotNull public OptionalBoolean map(@NotNull BooleanPredicate mapper) { if (!isPresent()) { return empty(); } Objects.requireNonNull(mapper); return OptionalBoolean.of(mapper.test(value)); } private  OptionalBoolean(); private  OptionalBoolean(boolean value); @NotNull static OptionalBoolean empty(); @NotNull static OptionalBoolean of(boolean value); @NotNull static OptionalBoolean ofNullable(@Nullable Boolean value); boolean getAsBoolean(); boolean isPresent(); boolean isEmpty(); void ifPresent(@NotNull BooleanConsumer consumer); void ifPresentOrElse(@NotNull BooleanConsumer consumer, @NotNull Runnable emptyAction); @NotNull OptionalBoolean executeIfPresent(@NotNull BooleanConsumer consumer); @NotNull OptionalBoolean executeIfAbsent(@NotNull Runnable action); @Nullable R custom(@NotNull Function<OptionalBoolean, R> function); @NotNull OptionalBoolean filter(@NotNull BooleanPredicate predicate); @NotNull OptionalBoolean filterNot(@NotNull BooleanPredicate predicate); @NotNull OptionalBoolean map(@NotNull BooleanPredicate mapper); @NotNull Optional<U> mapToObj(@NotNull BooleanFunction<U> mapper); @NotNull OptionalBoolean or(@NotNull Supplier<OptionalBoolean> supplier); boolean orElse(boolean other); boolean orElseGet(@NotNull BooleanSupplier other); boolean orElseThrow(); boolean orElseThrow(@NotNull Supplier<X> exceptionSupplier); @Override boolean equals(Object obj); @Override int hashCode(); @NotNull @Override String toString(); }
OptionalBoolean { @NotNull public OptionalBoolean map(@NotNull BooleanPredicate mapper) { if (!isPresent()) { return empty(); } Objects.requireNonNull(mapper); return OptionalBoolean.of(mapper.test(value)); } private  OptionalBoolean(); private  OptionalBoolean(boolean value); @NotNull static OptionalBoolean empty(); @NotNull static OptionalBoolean of(boolean value); @NotNull static OptionalBoolean ofNullable(@Nullable Boolean value); boolean getAsBoolean(); boolean isPresent(); boolean isEmpty(); void ifPresent(@NotNull BooleanConsumer consumer); void ifPresentOrElse(@NotNull BooleanConsumer consumer, @NotNull Runnable emptyAction); @NotNull OptionalBoolean executeIfPresent(@NotNull BooleanConsumer consumer); @NotNull OptionalBoolean executeIfAbsent(@NotNull Runnable action); @Nullable R custom(@NotNull Function<OptionalBoolean, R> function); @NotNull OptionalBoolean filter(@NotNull BooleanPredicate predicate); @NotNull OptionalBoolean filterNot(@NotNull BooleanPredicate predicate); @NotNull OptionalBoolean map(@NotNull BooleanPredicate mapper); @NotNull Optional<U> mapToObj(@NotNull BooleanFunction<U> mapper); @NotNull OptionalBoolean or(@NotNull Supplier<OptionalBoolean> supplier); boolean orElse(boolean other); boolean orElseGet(@NotNull BooleanSupplier other); boolean orElseThrow(); boolean orElseThrow(@NotNull Supplier<X> exceptionSupplier); @Override boolean equals(Object obj); @Override int hashCode(); @NotNull @Override String toString();  }