citerus / dddsample-core

This is the new home of the original DDD Sample app (previously hosted at sf.net)..
MIT License
4.99k stars 1.47k forks source link

Replace ObjectUtils.defaultIfNull with Objects.requireNonNullElse #81

Closed orende closed 1 year ago

orende commented 1 year ago

Why

The current codebase uses a third-party library (Apache Commons) to provide the ObjectUtils.defaultIfNull method for providing a default value in case of a null reference. This was the standard practice before Java 11+, but an equivalent method has now been introduced to the standard library in the form of Objects.requireNonNullElse. This means we can work towards reducing the amount of third-party dependencies, which improves maintainability.

What

Replaces all occurrences of ObjectUtils.defaultIfNull with Objects.requireNonNullElse.