Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Finding the max in a java collection using streams
public Optional<Integer> max(Collection<Integer> collection) {
// usage
List<Integer> list = ...;
int m = max(list).orElse(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment