[
https://issues.apache.org/jira/browse/ARTEMIS-5534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Bertram updated ARTEMIS-5534:
------------------------------------
Description:
There are lots of places across the code-base which do a check like this:
{code:java}
foo != null ? foo : bar{code}
or
{code:java}
foo == null ? bar : foo{code}
Many of these can be replaced, e.g.:
{code:java}
Objects.requireNonNullElse(foo, bar){code}
Also, code like:
{code:java}
foo != null ? foo : calculateBar(){code}
Can be replaced with something like:
{code:java}
Objects.requireNonNullElseGet(foo, () -> calculateBar()){code}
was:
There are lots of places across the code-base which do a check like this:
{code:java}
foo != null ? foo : bar{code}
or
{code:java}
foo == null ? bar : foo{code}
Many of these can be replaced, e.g.:
{code:java}
Objects.requireNonNullElse(foo, bar){code}
Also, code like:
{code:java}
foo != null ? foo : calculateBar(){code}
Can be replaced with something like:
{code:java}
Objects.requireNonNullElseGet(foo, () -> calculateBar()){code}
This code is more clear and will make the code-base more consistent overall.
> Use Objects.requireNonNullElse() where sensible
> -----------------------------------------------
>
> Key: ARTEMIS-5534
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5534
> Project: ActiveMQ Artemis
> Issue Type: Task
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> There are lots of places across the code-base which do a check like this:
> {code:java}
> foo != null ? foo : bar{code}
> or
> {code:java}
> foo == null ? bar : foo{code}
> Many of these can be replaced, e.g.:
> {code:java}
> Objects.requireNonNullElse(foo, bar){code}
> Also, code like:
> {code:java}
> foo != null ? foo : calculateBar(){code}
> Can be replaced with something like:
> {code:java}
> Objects.requireNonNullElseGet(foo, () -> calculateBar()){code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact