diff --git a/src/java.base/share/classes/java/util/Optional.java b/src/java.base/share/classes/java/util/Optional.java --- a/src/java.base/share/classes/java/util/Optional.java +++ b/src/java.base/share/classes/java/util/Optional.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,9 @@ import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; +import java.util.function.ToDoubleFunction; +import java.util.function.ToIntFunction; +import java.util.function.ToLongFunction; import java.util.stream.Stream; /** @@ -267,6 +270,69 @@ } /** + * If a value is present, returns an {@code OptionalInt} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalInt}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalInt} describing the result of applying a + * mapping function to the value of this {@code Optional}, if a + * value is present, otherwise an empty {@code Optional} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalInt mapToInt(ToIntFunction super T> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalInt.empty(); + } else { + return OptionalInt.of(mapper.applyAsInt(value)); + } + } + + /** + * If a value is present, returns an {@code OptionalLong} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalLong}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalLong} describing the result of applying a + * mapping function to the value of this {@code Optional}, if a + * value is present, otherwise an empty {@code Optional} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalLong mapToLong(ToLongFunction super T> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalLong.empty(); + } else { + return OptionalLong.of(mapper.applyAsLong(value)); + } + } + + /** + * If a value is present, returns an {@code OptionalDouble} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalDouble}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalDouble} describing the result of applying a + * mapping function to the value of this {@code Optional}, if a + * value is present, otherwise an empty {@code Optional} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalDouble mapToDouble(ToDoubleFunction super T> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalDouble.empty(); + } else { + return OptionalDouble.of(mapper.applyAsDouble(value)); + } + } + + /** * If a value is present, returns the result of applying the given * {@code Optional}-bearing mapping function to the value, otherwise returns * an empty {@code Optional}. @@ -297,6 +363,90 @@ } /** + * If a value is present, returns the result of applying the given + * {@code OptionalInt}-bearing mapping function to the value, otherwise + * returns an empty {@code OptionalInt}. + * + *
This method is similar to {@link #mapToInt(ToIntFunction)}, but the + * mapping function is one whose result is already an {@code OptionalInt}, + * and if invoked, {@code flatMapToInt} does not wrap it within an + * additional {@code OptionalInt}. + * + * @param mapper the mapping function to apply to a value, if present + * @return the result of applying an {@code OptionalInt}-bearing mapping + * function to the value of this {@code Optional}, if a value is + * present, otherwise an empty {@code OptionalInt} + * @throws NullPointerException if the mapping function is {@code null} or + * returns a {@code null} result + * @since 13 + */ + public OptionalInt flatMapToInt(Function super T, ? extends OptionalInt> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalInt.empty(); + } else { + OptionalInt r = mapper.apply(value); + return Objects.requireNonNull(r); + } + } + + /** + * If a value is present, returns the result of applying the given + * {@code OptionalLong}-bearing mapping function to the value, otherwise + * returns an empty {@code OptionalLong}. + * + *
This method is similar to {@link #mapToLong(ToLongFunction)}, but the + * mapping function is one whose result is already an {@code OptionalLong}, + * and if invoked, {@code flatMapToLong} does not wrap it within an + * additional {@code OptionalLong}. + * + * @param mapper the mapping function to apply to a value, if present + * @return the result of applying an {@code OptionalLong}-bearing mapping + * function to the value of this {@code Optional}, if a value is + * present, otherwise an empty {@code OptionalLong} + * @throws NullPointerException if the mapping function is {@code null} or + * returns a {@code null} result + * @since 13 + */ + public OptionalLong flatMapToLong(Function super T, ? extends OptionalLong> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalLong.empty(); + } else { + OptionalLong r = mapper.apply(value); + return Objects.requireNonNull(r); + } + } + + /** + * If a value is present, returns the result of applying the given + * {@code OptionalDouble}-bearing mapping function to the value, otherwise + * returns an empty {@code OptionalDouble}. + * + *
This method is similar to {@link #mapToDouble(ToDoubleFunction)}, but + * the mapping function is one whose result is already an + * {@code OptionalDouble}, and if invoked, {@code flatMapToDouble} does not + * wrap it within an additional {@code OptionalDouble}. + * + * @param mapper the mapping function to apply to a value, if present + * @return the result of applying an {@code OptionalDouble}-bearing mapping + * function to the value of this {@code Optional}, if a value is + * present, otherwise an empty {@code OptionalDouble} + * @throws NullPointerException if the mapping function is {@code null} or + * returns a {@code null} result + * @since 13 + */ + public OptionalDouble flatMapToDouble(Function super T, ? extends OptionalDouble> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalDouble.empty(); + } else { + OptionalDouble r = mapper.apply(value); + return Objects.requireNonNull(r); + } + } + + /** * If a value is present, returns an {@code Optional} describing the value, * otherwise returns an {@code Optional} produced by the supplying function. * diff --git a/src/java.base/share/classes/java/util/OptionalDouble.java b/src/java.base/share/classes/java/util/OptionalDouble.java --- a/src/java.base/share/classes/java/util/OptionalDouble.java +++ b/src/java.base/share/classes/java/util/OptionalDouble.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,11 @@ package java.util; import java.util.function.DoubleConsumer; +import java.util.function.DoubleFunction; import java.util.function.DoubleSupplier; +import java.util.function.DoubleToIntFunction; +import java.util.function.DoubleToLongFunction; +import java.util.function.DoubleUnaryOperator; import java.util.function.Supplier; import java.util.stream.DoubleStream; @@ -185,6 +189,146 @@ } /** + * If a value is present, returns an {@code OptionalDouble} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalDouble}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalDouble} describing the result of applying a + * mapping function to the value of this {@code OptionalDouble}, if + * a value is present, otherwise an empty {@code OptionalDouble} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalDouble map(DoubleUnaryOperator mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalDouble.empty(); + } else { + return OptionalDouble.of(mapper.applyAsDouble(value)); + } + } + + /** + * If a value is present, returns an {@code Optional} describing (as if by + * {@link Optional#ofNullable}) the result of applying the given mapping + * function to the value, otherwise returns an empty {@code Optional}. + * + *
If the mapping function returns a {@code null} result then this method + * returns an empty {@code Optional}. + * + * @param mapper the mapping function to apply to a value, if present + * @param The type of the value returned from the mapping function + * @return an {@code Optional} describing the result of applying a mapping + * function to the value of this {@code OptionalDouble}, if a value + * is present, otherwise an empty {@code Optional} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public Optional mapToObj(DoubleFunction extends U> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return Optional.empty(); + } else { + return Optional.ofNullable(mapper.apply(value)); + } + } + + /** + * If a value is present, returns an {@code OptionalInt} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalInt}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalInt} describing the result of applying a + * mapping function to the value of this {@code OptionalDouble}, if + * a value is present, otherwise an empty {@code OptionalInt} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalInt mapToInt(DoubleToIntFunction mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalInt.empty(); + } else { + return OptionalInt.of(mapper.applyAsInt(value)); + } + } + + /** + * If a value is present, returns an {@code OptionalLong} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalLong}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalLong} describing the result of applying a + * mapping function to the value of this {@code OptionalDouble}, if + * a value is present, otherwise an empty {@code OptionalLong} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalLong mapToLong(DoubleToLongFunction mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalLong.empty(); + } else { + return OptionalLong.of(mapper.applyAsLong(value)); + } + } + + /** + * If a value is present, returns the result of applying the given + * {@code OptionalDouble}-bearing mapping function to the value, otherwise + * returns an empty {@code OptionalDouble}. + * + *
This method is similar to {@link #map(DoubleUnaryOperator)}, but the + * mapping function is one whose result is already an + * {@code OptionalDouble}, and if invoked, {@code flatMap} does not wrap it + * within an additional {@code OptionalDouble}. + * + * @param mapper the mapping function to apply to a value, if present + * @return the result of applying an {@code OptionalDouble}-bearing mapping + * function to the value of this {@code OptionalDouble}, if a value + * is present, otherwise an empty {@code OptionalDouble} + * @throws NullPointerException if the mapping function is {@code null} or + * returns a {@code null} result + * @since 13 + */ + public OptionalDouble flatMap(DoubleFunction extends OptionalDouble> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalDouble.empty(); + } else { + OptionalDouble r = mapper.apply(value); + return Objects.requireNonNull(r); + } + } + + /** + * If a value is present, returns an {@code OptionalDouble} describing the + * value, otherwise returns an {@code OptionalDouble} produced by the supplying + * function. + * + * @param supplier the supplying function that produces an + * {@code OptionalDouble} to be returned + * @return returns an {@code OptionalDouble} describing the value of this + * {@code OptionalDouble}, if a value is present, otherwise an + * {@code OptionalDouble} produced by the supplying function. + * @throws NullPointerException if the supplying function is {@code null} or + * produces a {@code null} result + * @since 13 + */ + public OptionalDouble or(Supplier extends OptionalDouble> supplier) { + Objects.requireNonNull(supplier); + if (isPresent()) { + return this; + } else { + OptionalDouble r = supplier.get(); + return Objects.requireNonNull(r); + } + } + + /** * If a value is present, returns a sequential {@link DoubleStream} * containing only that value, otherwise returns an empty * {@code DoubleStream}. diff --git a/src/java.base/share/classes/java/util/OptionalInt.java b/src/java.base/share/classes/java/util/OptionalInt.java --- a/src/java.base/share/classes/java/util/OptionalInt.java +++ b/src/java.base/share/classes/java/util/OptionalInt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,11 @@ package java.util; import java.util.function.IntConsumer; +import java.util.function.IntFunction; import java.util.function.IntSupplier; +import java.util.function.IntToDoubleFunction; +import java.util.function.IntToLongFunction; +import java.util.function.IntUnaryOperator; import java.util.function.Supplier; import java.util.stream.IntStream; @@ -185,6 +189,146 @@ } /** + * If a value is present, returns an {@code OptionalInt} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalInt}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalInt} describing the result of applying a + * mapping function to the value of this {@code OptionalInt}, if a + * value is present, otherwise an empty {@code OptionalInt} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalInt map(IntUnaryOperator mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalInt.empty(); + } else { + return OptionalInt.of(mapper.applyAsInt(value)); + } + } + + /** + * If a value is present, returns an {@code Optional} describing (as if by + * {@link Optional#ofNullable}) the result of applying the given mapping + * function to the value, otherwise returns an empty {@code Optional}. + * + *
If the mapping function returns a {@code null} result then this method + * returns an empty {@code Optional}. + * + * @param mapper the mapping function to apply to a value, if present + * @param The type of the value returned from the mapping function + * @return an {@code Optional} describing the result of applying a mapping + * function to the value of this {@code OptionalInt}, if a value is + * present, otherwise an empty {@code Optional} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public Optional mapToObj(IntFunction extends U> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return Optional.empty(); + } else { + return Optional.ofNullable(mapper.apply(value)); + } + } + + /** + * If a value is present, returns an {@code OptionalLong} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalLong}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalLong} describing the result of applying a + * mapping function to the value of this {@code OptionalInt}, if a + * value is present, otherwise an empty {@code OptionalLong} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalLong mapToLong(IntToLongFunction mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalLong.empty(); + } else { + return OptionalLong.of(mapper.applyAsLong(value)); + } + } + + /** + * If a value is present, returns an {@code OptionalDouble} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalDouble}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalDouble} describing the result of applying a + * mapping function to the value of this {@code OptionalInt}, if a + * value is present, otherwise an empty {@code OptionalDouble} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalDouble mapToDouble(IntToDoubleFunction mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalDouble.empty(); + } else { + return OptionalDouble.of(mapper.applyAsDouble(value)); + } + } + + /** + * If a value is present, returns the result of applying the given + * {@code OptionalInt}-bearing mapping function to the value, otherwise + * returns an empty {@code OptionalInt}. + * + *
This method is similar to {@link #map(IntUnaryOperator)}, but the + * mapping function is one whose result is already an {@code OptionalInt}, + * and if invoked, {@code flatMap} does not wrap it within an additional + * {@code OptionalInt}. + * + * @param mapper the mapping function to apply to a value, if present + * @return the result of applying an {@code OptionalInt}-bearing mapping + * function to the value of this {@code OptionalInt}, if a value is + * present, otherwise an empty {@code OptionalInt} + * @throws NullPointerException if the mapping function is {@code null} or + * returns a {@code null} result + * @since 13 + */ + public OptionalInt flatMap(IntFunction extends OptionalInt> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalInt.empty(); + } else { + OptionalInt r = mapper.apply(value); + return Objects.requireNonNull(r); + } + } + + /** + * If a value is present, returns an {@code OptionalInt} describing the + * value, otherwise returns an {@code OptionalInt} produced by the supplying + * function. + * + * @param supplier the supplying function that produces an + * {@code OptionalInt} to be returned + * @return returns an {@code OptionalInt} describing the value of this + * {@code OptionalInt}, if a value is present, otherwise an + * {@code OptionalInt} produced by the supplying function. + * @throws NullPointerException if the supplying function is {@code null} or + * produces a {@code null} result + * @since 13 + */ + public OptionalInt or(Supplier extends OptionalInt> supplier) { + Objects.requireNonNull(supplier); + if (isPresent()) { + return this; + } else { + OptionalInt r = supplier.get(); + return Objects.requireNonNull(r); + } + } + + /** * If a value is present, returns a sequential {@link IntStream} containing * only that value, otherwise returns an empty {@code IntStream}. * diff --git a/src/java.base/share/classes/java/util/OptionalLong.java b/src/java.base/share/classes/java/util/OptionalLong.java --- a/src/java.base/share/classes/java/util/OptionalLong.java +++ b/src/java.base/share/classes/java/util/OptionalLong.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,11 @@ package java.util; import java.util.function.LongConsumer; +import java.util.function.LongFunction; import java.util.function.LongSupplier; +import java.util.function.LongToDoubleFunction; +import java.util.function.LongToIntFunction; +import java.util.function.LongUnaryOperator; import java.util.function.Supplier; import java.util.stream.LongStream; @@ -185,6 +189,146 @@ } /** + * If a value is present, returns an {@code OptionalLong} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalLong}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalLong} describing the result of applying a + * mapping function to the value of this {@code OptionalLong}, if a + * value is present, otherwise an empty {@code OptionalLong} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalLong map(LongUnaryOperator mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalLong.empty(); + } else { + return OptionalLong.of(mapper.applyAsLong(value)); + } + } + + /** + * If a value is present, returns an {@code Optional} describing (as if by + * {@link Optional#ofNullable}) the result of applying the given mapping + * function to the value, otherwise returns an empty {@code Optional}. + * + *
If the mapping function returns a {@code null} result then this method + * returns an empty {@code Optional}. + * + * @param mapper the mapping function to apply to a value, if present + * @param The type of the value returned from the mapping function + * @return an {@code Optional} describing the result of applying a mapping + * function to the value of this {@code OptionalLong}, if a value + * is present, otherwise an empty {@code Optional} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public Optional mapToObj(LongFunction extends U> mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return Optional.empty(); + } else { + return Optional.ofNullable(mapper.apply(value)); + } + } + + /** + * If a value is present, returns an {@code OptionalInt} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalInt}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalInt} describing the result of applying a + * mapping function to the value of this {@code OptionalLong}, if a + * value is present, otherwise an empty {@code OptionalInt} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalInt mapToInt(LongToIntFunction mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalInt.empty(); + } else { + return OptionalInt.of(mapper.applyAsInt(value)); + } + } + + /** + * If a value is present, returns an {@code OptionalDouble} describing the + * result of applying the given mapping function to the value, otherwise + * returns an empty {@code OptionalDouble}. + * + * @param mapper the mapping function to apply to a value, if present + * @return an {@code OptionalDouble} describing the result of applying a + * mapping function to the value of this {@code OptionalLong}, if a + * value is present, otherwise an empty {@code OptionalDouble} + * @throws NullPointerException if the mapping function is {@code null} + * @since 13 + */ + public OptionalDouble mapToDouble(LongToDoubleFunction mapper) { + Objects.requireNonNull(mapper); + if (!isPresent()) { + return OptionalDouble.empty(); + } else { + return OptionalDouble.of(mapper.applyAsDouble(value)); + } + } + + /** + * If a value is present, returns the result of applying the given + * {@code OptionalLong}-bearing mapping function to the value, otherwise + * returns an empty {@code OptionalLong}. + * + *
This method is similar to {@link #map(LongUnaryOperator)}, but the
+ * mapping function is one whose result is already an {@code OptionalLong},
+ * and if invoked, {@code flatMap} does not wrap it within an additional
+ * {@code OptionalLong}.
+ *
+ * @param mapper the mapping function to apply to a value, if present
+ * @return the result of applying an {@code OptionalLong}-bearing mapping
+ * function to the value of this {@code OptionalLong}, if a value is
+ * present, otherwise an empty {@code OptionalLong}
+ * @throws NullPointerException if the mapping function is {@code null} or
+ * returns a {@code null} result
+ * @since 13
+ */
+ public OptionalLong flatMap(LongFunction extends OptionalLong> mapper) {
+ Objects.requireNonNull(mapper);
+ if (!isPresent()) {
+ return OptionalLong.empty();
+ } else {
+ OptionalLong r = mapper.apply(value);
+ return Objects.requireNonNull(r);
+ }
+ }
+
+ /**
+ * If a value is present, returns an {@code OptionalLong} describing the
+ * value, otherwise returns an {@code OptionalLong} produced by the
+ * supplying function.
+ *
+ * @param supplier the supplying function that produces an
+ * {@code OptionalLong} to be returned
+ * @return returns an {@code OptionalLong} describing the value of this
+ * {@code OptionalLong}, if a value is present, otherwise an
+ * {@code OptionalLong} produced by the supplying function.
+ * @throws NullPointerException if the supplying function is {@code null} or
+ * produces a {@code null} result
+ * @since 13
+ */
+ public OptionalLong or(Supplier extends OptionalLong> supplier) {
+ Objects.requireNonNull(supplier);
+ if (isPresent()) {
+ return this;
+ } else {
+ OptionalLong r = supplier.get();
+ return Objects.requireNonNull(r);
+ }
+ }
+
+ /**
* If a value is present, returns a sequential {@link LongStream} containing
* only that value, otherwise returns an empty {@code LongStream}.
*
diff --git a/test/jdk/java/util/Optional/Basic.java b/test/jdk/java/util/Optional/Basic.java
--- a/test/jdk/java/util/Optional/Basic.java
+++ b/test/jdk/java/util/Optional/Basic.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,9 @@
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
import java.util.concurrent.atomic.AtomicBoolean;
import static java.util.stream.Collectors.toList;
@@ -44,7 +47,7 @@
/**
* Checks a block of assertions over an empty Optional.
*/
- void checkEmpty(Optional