Last active
November 6, 2017 22:00
-
-
Save pellse/b7098563757230bb93b417c1481c0859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void handleAllOrdersOf(List<Customer> customers) { | |
Optional.ofNullable(customers) | |
.map(unchecked(this::queryDatabaseForAllOrders)) // Sneaky throw, SQLException | |
.orElseGet(Collections::emptyList) | |
.forEach(this::processOrder); | |
} | |
public List queryDatabaseForAllOrders(List<Customer> customers) throws SQLException { | |
// Query database, retrieve all orders for all customers | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment