Performance tips!

Boxing and unboxing cost might be high especially when in a loop (can create many heap allocations).

Tail recursion If you find yourself in a situation where you are doing a recursive call (where you should first find for already existing library function to do the operation for you instead of recursive call), then do whatever possible for the recursive call to be tail recursive. A function is tail recursive if the recursive call is the last instruction performed which means only first call is in stack. A hint for many tail recursive call is that you pass some accumulator inside the recursive call, which means you are doing the calculation in the next step in the recursion as opposed to holding the accumulator outside the tail recursive call.
1

I recently published this in stackoverflow, enjoy

Our plan

I'm not a scala mega mind so feel free to correct me, but this is how I explain the flatMap/map/for-comprehension saga to myself!

To understand for comprehension and it's translation to scala's map / flatMap we must take small steps and understand the composing parts - map and flatMap.
Popular Posts
Popular Posts
Contributors
Contributors
Archive
Labels
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.