public class OptionalInt extends Object
int or an unset value. Unlike an
int, an OptionalInt may be empty.| Constructor and Description |
|---|
OptionalInt()
Default constructor that creates an empty
OptionalInt object. |
OptionalInt(int val)
Constructor specifying an
int. |
| Modifier and Type | Method and Description |
|---|---|
int |
getInt()
Accessor that returns the
int of this OptionalInt. |
boolean |
isEmpty()
Returns whether this
OptionalInt is empty. |
public OptionalInt()
OptionalInt object.public OptionalInt(int val)
int.val - The value of the int the
OptionalInt holds.public int getInt()
throws NoSuchElementException
int of this OptionalInt.int of this OptionalInt.NoSuchElementExceptionpublic boolean isEmpty()
OptionalInt is empty.OptionalInt is empty.© 2003, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle and/or its affiliates Confidential