garydgregory commented on pull request #857: URL: https://github.com/apache/commons-lang/pull/857#issuecomment-1048981265
> > Hello @Mikhail2048 & @ecki The new method name does not match its internal test, one or the other needs fixing. Since the method works on any Object, not a String, it likely belongs next to `ObjectUtils.toString(Object, Supplier<String>)`. Please adjust this PR. > > I think it is not entirely true. We cannot test any given object for emptiness, so, if we have `ObjectUtils.toString(Object, Supplier<String>)`, then I do not understand how should we test passed object for emptiness. We can, of course, test if passed object is `null` and then apply `Supplier`, but empty string and null string are not the same. > > I think the appropriate solution would look like this: in general is a great idea to implement something like `ObjectUtils.applyIfNull(T, Supplier<T>)`, but I think we should left `StringUtils.defaultIfEmpty(final T source, final Supplier<T> default)`, maybe with slightly different name, for example `StringUtils.applyIfNull(final T source, final Supplier<T> default)` We have ObjectUtils#isEmpty() but we could have a String specific version I suppose... -- 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