[
https://issues.apache.org/jira/browse/LANG-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Peter Verhas updated LANG-1477:
-------------------------------
Summary: Implement castToXXX in Functions class (was: Implement caseToXXX
in Functions class)
> Implement castToXXX in Functions class
> --------------------------------------
>
> Key: LANG-1477
> URL: https://issues.apache.org/jira/browse/LANG-1477
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 3.9
> Reporter: Peter Verhas
> Priority: Minor
> Labels: newbie
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> Proposal to implement functional interface conversion functions in the class
> {{org.apache.commons.lang3.Functions}} that convert {{FailableXXX}} to
> {{XXX}}.
> For example, the FailableRunnable can be converted with the method:
>
> {code:java}
> static <K extends Throwable> Runnable castToRunnable(FailableRunnable<K> s) {
> return () -> {
> try {
> s.run();
> } catch (Throwable k) {
> rethrow(k);
> }
> };
> }{code}
>
> I believe that these casting methods will have a huge user base for the
> application when a lambda expression throws checked exception and is to be
> used inside a stream chain. Apache Commons is a well-established library to
> become the de-facto standard if it gets implemented.
>
> I will implement the change and will issue a pull request as my free time
> allows.
>
--
This message was sent by Atlassian Jira
(v8.3.2#803003)