Additional methods that depend on the presence or absence of a contained value are provided, such as {@link #orElse(int) orElse()}(return a default value if value not present) and {@link #ifPresent(java.util.function.IntConsumer) ifPresent()} (execute a blockof code if the value is present).
This is a value-based class; use of identity-sensitive operations (including reference equality ( {@code ==}), identity hash code, or synchronization) on instances of {@code OptionalInt} may have unpredictable results and should be avoided. @since 1.8
|
|