[LANG-1498] Add support of lambda value evaluation for defaulting

methods #416.

Better param name.
This commit is contained in:
Gary Gregory 2019-11-01 00:04:02 -04:00
parent c47e5f95f6
commit a4c60c4e01
1 changed files with 3 additions and 3 deletions

View File

@ -170,12 +170,12 @@ public class ObjectUtils {
*
* @param <T> the type of the object
* @param object the {@code Object} to test, may be {@code null}
* @param defaultValueSupplier the default value to return, may be {@code null}
* @param defaultSupplier the default value to return, may be {@code null}
* @return {@code object} if it is not {@code null}, {@code defaultValueSupplier.get()} otherwise
* @since 3.10
*/
public static <T> T defaultIfNull(final T object, final Supplier<T> defaultValueSupplier) {
return object != null ? object : defaultValueSupplier == null ? null : defaultValueSupplier.get();
public static <T> T defaultIfNull(final T object, final Supplier<T> defaultSupplier) {
return object != null ? object : defaultSupplier == null ? null : defaultSupplier.get();
}
/**