Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.
Permalink
Browse files
8228615: Optional.empty doc should suggest using isEmpty
Reviewed-by: lancea, bpb, naoto
  • Loading branch information
Stuart Marks committed Dec 3, 2020
1 parent 805d058 commit 2b73f9929f89693b9fb09e368eae55f95c57002c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@@ -74,9 +74,9 @@
*
* @apiNote
* Though it may be tempting to do so, avoid testing if an object is empty
* by comparing with {@code ==} against instances returned by
* by comparing with {@code ==} or {@code !=} against instances returned by
* {@code Optional.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
* Instead, use {@link #isEmpty()} or {@link #isPresent()}.
*
* @param <T> The type of the non-existent value
* @return an empty {@code Optional}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@@ -83,9 +83,9 @@ private OptionalDouble() {
*
* @apiNote
* Though it may be tempting to do so, avoid testing if an object is empty
* by comparing with {@code ==} against instances returned by
* by comparing with {@code ==} or {@code !=} against instances returned by
* {@code OptionalDouble.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
* Instead, use {@link #isEmpty()} or {@link #isPresent()}.
*
* @return an empty {@code OptionalDouble}.
*/
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@@ -83,9 +83,9 @@ private OptionalInt() {
*
* @apiNote
* Though it may be tempting to do so, avoid testing if an object is empty
* by comparing with {@code ==} against instances returned by
* by comparing with {@code ==} or {@code !=} against instances returned by
* {@code OptionalInt.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
* Instead, use {@link #isEmpty()} or {@link #isPresent()}.
*
* @return an empty {@code OptionalInt}
*/
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@@ -83,9 +83,9 @@ private OptionalLong() {
*
* @apiNote
* Though it may be tempting to do so, avoid testing if an object is empty
* by comparing with {@code ==} against instances returned by
* by comparing with {@code ==} or {@code !=} against instances returned by
* {@code OptionalLong.empty()}. There is no guarantee that it is a singleton.
* Instead, use {@link #isPresent()}.
* Instead, use {@link #isEmpty()} or {@link #isPresent()}.
*
* @return an empty {@code OptionalLong}.
*/

0 comments on commit 2b73f99

Please sign in to comment.