Last active
May 17, 2018 02:59
-
-
Save asela38/477e0b5359d0e4b7340a670ca01e464e to your computer and use it in GitHub Desktop.
Program to Check Stack Size Change
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 class TestStackSize { | |
public static void main(String[] args) { | |
System.out.println(IntStream.generate(() -> { | |
AtomicInteger i = new AtomicInteger(0); | |
try { | |
new TestStackSize().call(i); | |
} catch (Throwable e) { | |
return i.get(); | |
} | |
return 0; | |
}).limit(15).skip(5).peek(System.out::println).average()); | |
} | |
private void call(AtomicInteger i) { | |
i.incrementAndGet(); | |
call(i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment