How to avoid StackOverflowError for a recursive function

后端 未结 6 1532
无人共我
无人共我 2021-01-01 18:19

I\'m writing a function that will call itself up to about 5000 times. Ofcourse, I get a StackOverflowError. Is there any way that I can rewrite this code in a f

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-01 19:04

    You may put your "Block"s into a queue/stack and iterate as long as Blocks are available.

提交回复
热议问题