diff options
| author | Vivek Theeyarath <vtheeyarath@openjdk.org> | 2018-04-18 10:30:57 -0700 |
|---|---|---|
| committer | Vivek Theeyarath <vtheeyarath@openjdk.org> | 2018-04-18 10:30:57 -0700 |
| commit | 702ac597adc0b4cf7e4dbb79f5116894e727ca49 (patch) | |
| tree | a8e6ad3bffea4730ef571b633ef5ea1e94311164 /src/java.base/share/classes/java/util/OptionalInt.java | |
| parent | 03a10ec7b28b50685ab0cbbedeaa7bdcf5602b30 (diff) | |
| download | openjdk-702ac597adc0b4cf7e4dbb79f5116894e727ca49.tar.gz openjdk-702ac597adc0b4cf7e4dbb79f5116894e727ca49.zip | |
8184693: add Pattern.isEmpty
Added method Pattern.isEmpty
Reviewed-by: forax, chegar, smarks, psandoz, rriggs
Diffstat (limited to 'src/java.base/share/classes/java/util/OptionalInt.java')
| -rw-r--r-- | src/java.base/share/classes/java/util/OptionalInt.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/java.base/share/classes/java/util/OptionalInt.java b/src/java.base/share/classes/java/util/OptionalInt.java index 61afe0206d1..7f97200f585 100644 --- 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, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, 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 @@ -140,6 +140,17 @@ public final class OptionalInt { } /** + * If a value is not present, returns {@code true}, otherwise + * {@code false}. + * + * @return {@code true} if a value is not present, otherwise {@code false} + * @since 11 + */ + public boolean isEmpty() { + return !isPresent; + } + + /** * If a value is present, performs the given action with the value, * otherwise does nothing. * |
