Java devs:

- `variable != null ? variable.method() : null`

or

`Optional.ofNullable(variable).map(Variable::method).orElse(null)`

?

@juliobiason The second one looks absolutely ridiculous. Definitely something I'd expect to see from some Java developers.

Follow

@juliobiason @loke Make an static import an you can write

`ofNullable(variable).map(Variable::method).orElse(null)`

Save a few spaces in that line 😉

Sign in to participate in the conversation
Ruhr.Social

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!