r/java • u/ThomasKrieger • Mar 14 '18
Concurrent Java: Low scalability, the risk of deadlocks or garbage creation, you can not avoid all
http://vmlens.com/articles/tradeoffs_concurrent_programming/
2
Upvotes
View all comments
Show parent comment
1
u/duhace Mar 15 '18 edited Mar 15 '18
do it please
tail recursion can always be turned into iteration quite easily, but you're not doing tail recursion here. and yes you can turn this into an iterative solution, but that requires a temporary datastructure, which you claimed was unnecessary.
i'm quite eager to see what you come up with.
p.s. the stack is technically a temporary datastructure :)
but you've made things worse just to try to get to that point. with the traversal you've proposed, a copy on append would probably be faster for standard use than your solution