Last active
April 4, 2017 16:28
-
-
Save HennIdan/a3888f9d8b5bb4b49e74e2ef52500e29 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
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