garydgregory commented on a change in pull request #857: URL: https://github.com/apache/commons-lang/pull/857#discussion_r813760188
########## File path: src/main/java/org/apache/commons/lang3/ObjectUtils.java ########## @@ -1152,6 +1152,20 @@ public static boolean isNotEmpty(final Object object) { return result; } + /** + * Get passed {@code object} in case it is not null, otherwise return the value produced by supplier + * + * Consider to utilize this method if lazy computation of default value makes sense in your case + * + * @param object to get if not null else to apply passed {@link Supplier} + * @param supplier {@link Supplier} to utilize in case provided {@code object} is null + * @param <T> the type of the object + * @return passed {@code object} in case it is not null, otherwise return the value produced by supplier + */ + public static <T> T defaultIfNull(T object, Supplier<T> supplier) { + return object == null ? supplier.get() : object; Review comment: This duplicates `ObjectUtils.getIfNull(T, Supplier<T>)` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org