Skip to content

Commit eb137c0

Browse files
authored
Refine README (#216)
1 parent 0b12f03 commit eb137c0

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# Checked-Exceptions-enabled Java 8+ Functional Interfaces
2-
and adapters
32

43
[![Build against JDKs](https://github.com/pivovarit/throwing-function/actions/workflows/build.yml/badge.svg)](https://github.com/pivovarit/throwing-function/actions/workflows/build.yml)
54
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
65
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.pivovarit/throwing-function/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.pivovarit/throwing-function)
76

87
[![Stargazers over time](https://starchart.cc/pivovarit/throwing-function.svg?variant=adaptive)](https://starchart.cc/pivovarit/throwing-function)
98

10-
## Rationale
9+
## Overview
1110

12-
Standard `java.util.function` Functional Interfaces aren't checked-exception-friendly due to the absence of `throws ...` clause which results in tedious and verbose necessity of handling them by adding `try-catch` boilerplate.
11+
Java’s standard `java.util.function` interfaces are not compatible with checked exceptions. This leads to verbose and cluttered code, requiring manual try-catch blocks for exception handling, which makes one-liners like this:
1312

14-
Which makes one-liners like this:
1513
```
1614
path -> new URI(path)
1715
```
@@ -27,17 +25,17 @@ path -> {
2725
}
2826
```
2927

30-
By applying `com.pivovarit.function` functional interfaces, it's possible to regain clarity and readability:
28+
This library introduces checked-exception-enabled functional interfaces, like `ThrowingFunction`, allowing cleaner, more concise code. You can now handle exceptions in functional pipelines without sacrificing readability:
3129

3230
ThrowingFunction<String, URI, URISyntaxException> toUri = URI::new;
3331

34-
and use them seamlessly with native `java.util.function` classes by using custom `ThrowingFunction#unchecked` adapters:
32+
Using the `ThrowingFunction#unchecked` adapter, this can be seamlessly integrated into standard streams:
3533

3634
...stream()
3735
.map(unchecked(URI::new)) // static import of ThrowingFunction#unchecked
3836
.forEach(System.out::println);
3937

40-
which avoids ending up with:
38+
This eliminates the need for bulky try-catch blocks within stream operations:
4139

4240
...stream().map(path -> {
4341
try {
@@ -46,7 +44,13 @@ which avoids ending up with:
4644
throw new RuntimeException(e);
4745
}}).forEach(System.out::println);
4846

49-
### Basic API
47+
### Key Features
48+
49+
- Functional Interfaces: Supports various functional types with checked exceptions.
50+
- Adapters: Provides utility methods to convert `Throwing*` types into standard Java functional interfaces.
51+
- Lightweight: No external dependencies, implemented using core Java libraries.
52+
53+
### Core API
5054

5155
#### Functional Interfaces
5256

@@ -95,6 +99,10 @@ None - the library is implemented using core Java libraries.
9599

96100
## Version history
97101

102+
## [1.6.0 (24-09-2024)](https://github.com/pivovarit/throwing-function/releases/tag/1.6.0)
103+
104+
* Added `Automatic-Module-Name` to MANIFEST
105+
98106
### [1.5.1 (06-05-2020)](https://github.com/pivovarit/throwing-function/releases/tag/1.5.1)
99107

100108
* Fixed visibility issues with `ThrowingIntFunction`

0 commit comments

Comments
 (0)