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.
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 ofObjects.requireNonNullElse
. This means we can work towards reducing the amount of third-party dependencies, which improves maintainability.What
Replaces all occurrences of
ObjectUtils.defaultIfNull
withObjects.requireNonNullElse
.