Integrated: 8274894: Use Optional.empty() instead of ofNullable(null) in HttpResponse.BodySubscribers.discarding

Andrey Turbanov duke at openjdk.java.net
Tue Oct 12 11:17:52 UTC 2021


On Wed, 18 Aug 2021 07:55:35 GMT, Andrey Turbanov <duke at openjdk.java.net> wrote:

> Usage of `Optional.ofNullable` is unnecessary when value is known. If it's `null` value Optional.empty() should be preferred, as it doesn't perform redundant `null` check.

This pull request has now been integrated.

Changeset: d04d4ee2
Author:    Andrey Turbanov <turbanoff at gmail.com>
Committer: Daniel Fuchs <dfuchs at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/d04d4ee2c193baf4339ee3025e3fbcd31d62f484
Stats:     2 lines in 1 file changed: 0 ins; 0 del; 2 mod

8274894: Use Optional.empty() instead of ofNullable(null) in HttpResponse.BodySubscribers.discarding

Reviewed-by: dfuchs

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

PR: https://git.openjdk.java.net/jdk/pull/5159


More information about the net-dev mailing list