Skip to content

Instantly share code, notes, and snippets.

@HennIdan
Last active April 4, 2017 16:28
Show Gist options
  • Save HennIdan/a3888f9d8b5bb4b49e74e2ef52500e29 to your computer and use it in GitHub Desktop.
Save HennIdan/a3888f9d8b5bb4b49e74e2ef52500e29 to your computer and use it in GitHub Desktop.
public int forEachLambdaMaxInteger() {
final Wrapper wrapper = new Wrapper();
wrapper.inner = Integer.MIN_VALUE;
integers.forEach(i -> helper(i, wrapper));
return wrapper.inner.intValue();
}
public static class Wrapper {
public Integer inner;
}
private int helper(int i, Wrapper wrapper) {
wrapper.inner = Math.max(i, wrapper.inner);
return wrapper.inner;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment