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

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Thu Oct 7 10:26:28 UTC 2021


On Wed, 18 Aug 2021 07:55:35 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> 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.

Not sure if it worth separate issue. But this this is small improvement in http client code.

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

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


More information about the net-dev mailing list