Skip to content

Commit b804927

Browse files
committed
Simplify the code
1 parent 6a1ce50 commit b804927

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

src/main/java/ch/powerunit/extensions/exceptions/CommonsCollections4Helper.java

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
package ch.powerunit.extensions.exceptions;
2121

2222
import static ch.powerunit.extensions.exceptions.Constants.verifySupplier;
23+
import static ch.powerunit.extensions.exceptions.ExceptionMapper.forException;
24+
import static ch.powerunit.extensions.exceptions.ExceptionMapper.forExceptions;
2325
import static ch.powerunit.extensions.exceptions.Constants.verifyPredicate;
2426
import static ch.powerunit.extensions.exceptions.Constants.verifyFunction;
2527
import static ch.powerunit.extensions.exceptions.Constants.verifyConsumer;
@@ -38,25 +40,40 @@
3840
* <p>
3941
* <b>This class is only available if commons-collections4 is available</b>
4042
* <p>
41-
* The mapping between the interface from <i>commons-collections4</i> and this library is the following :
43+
* The mapping between the interface from <i>commons-collections4</i> and this
44+
* library is the following :
4245
*
4346
* <table border="1" summary="Mapping between interfaces">
44-
* <tr><th>commons-collections4</th><th>powerunit-extensions-exceptions</th></tr>
45-
* <tr><td>Predicate</td><td>PredicateWithException</td></tr>
46-
* <tr><td>Factory</td><td>SupplierWithException</td></tr>
47-
* <tr><td>Transformer</td><td>FunctionWithException</td></tr>
48-
* <tr><td>Closure</td><td>ConsumerWithException</td></tr>
47+
* <tr>
48+
* <th>commons-collections4</th>
49+
* <th>powerunit-extensions-exceptions</th>
50+
* </tr>
51+
* <tr>
52+
* <td>Predicate</td>
53+
* <td>PredicateWithException</td>
54+
* </tr>
55+
* <tr>
56+
* <td>Factory</td>
57+
* <td>SupplierWithException</td>
58+
* </tr>
59+
* <tr>
60+
* <td>Transformer</td>
61+
* <td>FunctionWithException</td>
62+
* </tr>
63+
* <tr>
64+
* <td>Closure</td>
65+
* <td>ConsumerWithException</td>
66+
* </tr>
4967
* </table>
5068
*
5169
* @since 2.2.0
5270
*
5371
*/
5472
public final class CommonsCollections4Helper {
5573

56-
private static final Function<Exception, RuntimeException> DEFAULT_EXCEPTION_MAPPER = ExceptionMapper.forExceptions(
57-
ExceptionMapper.forException(ClassCastException.class, e -> e),
58-
ExceptionMapper.forException(IllegalArgumentException.class, e -> e),
59-
ExceptionMapper.forException(Exception.class, FunctorException::new));
74+
private static final Function<Exception, RuntimeException> DEFAULT_EXCEPTION_MAPPER = forExceptions(
75+
forException(ClassCastException.class, e -> e), forException(IllegalArgumentException.class, e -> e),
76+
forException(Exception.class, FunctorException::new));
6077

6178
private CommonsCollections4Helper() {
6279
}

0 commit comments

Comments
 (0)