vʌvr (formerly called Javaslang) is a non-commercial, non-profit object-functional library that runs with Java 8+. It aims to reduce the lines of code and increase code quality.
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 */);
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 */);