vavr
vavr copied to clipboard
Add support for threaded use of Try.withResources() for up to 3 arguments
It would be useful to be able to thread your Autocloseable resources when using Try.withResources() in common scenarios/use cases such as database related resource management (Connection, PreparedStatement, ResultSet).
For example :-
Try.withResources(dataSource::getConnection, conn -> conn.prepareStatement("SELECT id, name from books"), PreparedStatement::executeQuery).of(rs -> /* extract what you need from ResultSet */)
Is equivalent but preferable to :-
Try.of(() -> try(Connection conn = dataSource.getConnection(); PreparedStatement stmt = conn.prepareStatement("SELECT id, name from books"); ResultSet rs = stmt.executeQuery())).flatMap(rs -> /* extract what you need from ResultSet */);
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Please upload report for BASE (
version/1.x@58698b7). Learn more about missing BASE report.
Additional details and impacted files
@@ Coverage Diff @@
## version/1.x #2752 +/- ##
==============================================
Coverage ? 92.85%
Complexity ? 5273
==============================================
Files ? 89
Lines ? 12574
Branches ? 1598
==============================================
Hits ? 11675
Misses ? 711
Partials ? 188
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.