garydgregory commented on PR #1435: URL: https://github.com/apache/commons-lang/pull/1435#issuecomment-3218071842
Hello @richdougherty Thank you for your PR. I've considered a single method like this the past but I've never gone ahead and implemented it. Probably because it feels like a bit of a hack for working around the fact that Java has not implemented an Elvis operator. I'm sure there's a YT about that. That said I would simply call the method "apply" and the leave non-null semantics as Javadoc. Why 3 overloads? As soon as there are n overloads, someone will submit a request for n+1. I'd just go with a vararg and be done with it. These are edge cases that could be surprising: What if one of the given functions throws an NPE? Should that cause 'apply' to return null? It might be surprising if a method designed to handle nukes throws an NPE. What if I want to call a method that throws a checked exception? I guess we'd need a FailableFunction version or only have a FailableFunction version (since you can default it to a runtime exception). -- 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]
