Skip to content

Instantly share code, notes, and snippets.

@headius
Created July 27, 2011 09:47
Show Gist options
  • Save headius/1109026 to your computer and use it in GitHub Desktop.
Save headius/1109026 to your computer and use it in GitHub Desktop.
~/projects/indy-examples $ java -cp target/classes/ com.headius.indy.examples.IndyLoop 1000
500500
500500
~/projects/indy-examples $ # ok, that worked, let's keep bumping it up
~/projects/indy-examples $ java -cp target/classes/ com.headius.indy.examples.IndyLoop 10000
50005000
Exception in thread "main" java.lang.StackOverflowError
at com.headius.indy.examples.IndyLoop.addAll(IndyLoop.java:19)
at com.headius.indy.examples.IndyLoop.addAll(IndyLoop.java:20)
at com.headius.indy.examples.IndyLoop.addAll(IndyLoop.java:20)
at com.headius.indy.examples.IndyLoop.addAll(IndyLoop.java:20)
...
~/projects/indy-examples $ # method handles fared better than an "actually" recursive call...
~/projects/indy-examples $ java -cp target/classes/ com.headius.indy.examples.IndyLoop 100000
Illegal instruction
~/projects/indy-examples $ # uh-oh!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment