# extended-functions
A small project providing extensions and additions to Java 8's built-in functions.
## installation
Add the following to your pom.xml's dependencies:
```xml
...
com.github.markozajc
extended-functions
1.2
...
```
or your build.gradle:
```groovy
repositories {
...
mavenCentral()
...
}
dependencies {
...
api 'com.github.markozajc:extended-functions:1.0'
...
}
```
## usage
Some of this project's additions do not extend Java 8's built-in functions and can therefore not be used directly with Java's APIs. However, those that do (specifically certain E\* and AE\* ones) can be through casting. For example, one can use:
```java
files.forEach((EConsumer) Files::delete);
```
or with the catch-all-exceptions AE\* type:
```java
files.forEach((AEConsumer) Files::delete);
```
rather than the vanilla way of doing it:
```java
files.forEach(t -> {
try {
Files.delete(t);
} catch (IOException e) {
// the error handling logic
}
});
```
Note, however, that checked exceptions are _not_ wrapped into RuntimeException - they are instead rethrown directly using a generics hack (see com.github.markozajc.functions.exceptionable.Utilities). This unfortunately also means that they can't be caught directly, because javac will complain that `exception XYZException is never thrown in body of corresponding try statement`. You can get around that by declaring `throws` on the method itself, or by catching `Exception` and then running your handling logic based on `instanceof`.