apache/incubator-spark — pull request #179 by liancheng (2013-11-16 09:01:13+00:00)
Title: Rewrote some heavily imperative snippets in FP style

Just couldn't help to rewrite some heavily imperative snippets in FP style, which is (arguably) more readable and concise.

Collection view is properly used, so that mapping and filtering transformations don't need to traverse every element if not necessary.