Skip to content

Instantly share code, notes, and snippets.

@pellse
Created November 6, 2017 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pellse/a6c116ef7151a479446e243032cf4dad to your computer and use it in GitHub Desktop.
Save pellse/a6c116ef7151a479446e243032cf4dad to your computer and use it in GitHub Desktop.
private void handleAllOrdersOf(List<Customer> customers) throws SQLException {
Optional.ofNullable(customers)
.map(unchecked(this::queryDatabaseForAllOrders)) // No sneaky throw, RuntimeException
.orElseGet(Collections::emptyList)
.forEach(this::processOrder);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment