NullUtil.executeViaNullSafer method will execute the given function on Non-Null Values and, when the value is null It will return Null instead of executing the function.
NullUtil.executeExecutorOrDefault method will execute the given function on Non-Null Values and, If the value is null, It will return the given default value.
NullUtil.executeMutator method mutates the reference type values without returning anything. If the value is null, It will not do anything.
NullUtil.replaceNull method will replace the null value with the given defaultValue. when the value is not null, It will return the value.
NullUtil.hasText method is used to check the String value has any kind of text or not
.NullUtil.trimValue method will be used to trim the String without causing the null pointer Exception.
More details about this Util class you can find on my medium article(https://rcvaram.medium.com/remove-dirty-nullchecks-in-java-8aca833dc276) or my stackoverflow answer(https://stackoverflow.com/a/70200959/12894468).
Top comments (0)