Skip to content

Instantly share code, notes, and snippets.

@globulon
Created May 13, 2013 18:24
Show Gist options
  • Select an option

  • Save globulon/5570314 to your computer and use it in GitHub Desktop.

Select an option

Save globulon/5570314 to your computer and use it in GitHub Desktop.
First attempt to curry a side effect
private static <T> Consumer<T> traceMessage(final String prefix) {
return t -> System.out.println(String.format("%s: %s", prefix, t));
}
final Comparator<Person> compareAsc = Person::ageDifference;
people.stream().min(compareAsc).ifPresent(traceMessage("Younger"));
@globulon
Copy link
Author

Could work with Function<T, R> anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment