aidanow-uni commented on PR #1469: URL: https://github.com/apache/commons-lang/pull/1469#issuecomment-3445485280
Thanks for the feedback. I understand your concerns about reusability. There is actually prior use of this pattern in other Commons components. For example, [org.apache.commons.cli.CommandLine](https://github.com/apache/commons-cli/blob/master/src/main/java/org/apache/commons/cli/CommandLine.java) in Commons-CLI defines multiple getOptionValue and getParsedOptionValue overloads that accept a Supplier<T> as a lazy default value. This shows that Commons libraries already adopt the Supplier pattern for deferred evaluation. The proposed StringUtils.firstNonBlankSupplier() and firstNonEmptySupplier() generalise this concept: instead of one fallback supplier, they support a sequence of suppliers, evaluated lazily until a non-blank result is found. If the team feels the method is too niche for Lang, another approach is to mark it as “advanced/optional” in the javadoc, or maybe present it as part of a “supplier”-variants section. But I believe its generic nature warrants inclusion. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
