Recursion and Java

With Java hotspot compiler inlining frequently used methods, does that mean recursion has the same efficiency as a loop?

[quote]With Java hotspot compiler inlining frequently used methods, does that mean recursion has the same efficiency as a loop?
[/quote]
Yes, if you do tail recursion it is as efficient as a iterative solution. See:

http://www-106.ibm.com/developerworks/java/library/j-diag8.html

So this doesn’t apply to other forms of recursion?

[quote]So this doesn’t apply to other forms of recursion?
[/quote]
Many solutions implemented using recursion can be very hard to translate into an iterative counterpart (for example, double recursion). A recursive solution is often less efficient than an iterative counterpart because of the additional stack handling required, but it all depends on the quality of the iterative solution.

Don’t optimize prematurely and never without profiling data. A recursive solution is often much shorter, easier to read, implement and verify than an iterative counterpart, so start with a recusive solution if that fits for your problem.