Re:Code Smells: Iteration
by apta on Friday August 25, 2017 @08:02AM
(#15097779)
I saw some code like this:
And I thought it was abusing the map() call for side effects. However, it is still shorter than writing it out as follows:
So I didn't have a strong opinion either way since semantically both do the same (and in the case of Scala, the first one is potentially more performant since it relies on the JVM doing virtual dispatch as opposed to calling unapply() and matching, not to mention potentially less garbage being generated).
[ Parent
| on HN ]
There are no comments on this comment yet.