Integrated: 8291954: Use Optional.isEmpty instead of !Optional.isPresent in java.base

Andrey Turbanov aturbanov at openjdk.org
Sat Aug 6 09:56:40 UTC 2022


On Mon, 1 Aug 2022 06:51:44 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> I propose to replace usages of !Optional.isPresent() with Optional.isEmpty method.
> It's makes code a bit easier to read.
> Noticing negation before long chain of method calls is hard.

This pull request has now been integrated.

Changeset: ae520537
Author:    Andrey Turbanov <aturbanov at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ae52053757ca50c4b56989c9b0c6890e504e4088
Stats:     23 lines in 6 files changed: 0 ins; 2 del; 21 mod

8291954: Use Optional.isEmpty instead of !Optional.isPresent in java.base

Reviewed-by: jpai, alanb, lancea, rriggs, bpb

-------------

PR: https://git.openjdk.org/jdk/pull/9697


More information about the core-libs-dev mailing list