diff options
author | Sean Owen <sowen@cloudera.com> | 2016-07-30 04:42:38 -0700 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-07-30 04:42:38 -0700 |
commit | 0dc4310b470c7e4355c0da67ca3373c3013cc9dd (patch) | |
tree | 9a8ac5aefbb25188958e9ae028c7ffdc117b705a /mllib/src/main | |
parent | bbc247548ac6faeca15afc05c266cee37ef13416 (diff) | |
download | spark-0dc4310b470c7e4355c0da67ca3373c3013cc9dd.tar.gz spark-0dc4310b470c7e4355c0da67ca3373c3013cc9dd.tar.bz2 spark-0dc4310b470c7e4355c0da67ca3373c3013cc9dd.zip |
[SPARK-16694][CORE] Use for/foreach rather than map for Unit expressions whose side effects are required
## What changes were proposed in this pull request?
Use foreach/for instead of map where operation requires execution of body, not actually defining a transformation
## How was this patch tested?
Jenkins
Author: Sean Owen <sowen@cloudera.com>
Closes #14332 from srowen/SPARK-16694.
Diffstat (limited to 'mllib/src/main')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeans.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeans.scala b/mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeans.scala index 871b1c7d21..9a3d64fca5 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeans.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeans.scala @@ -268,7 +268,7 @@ class KMeans private ( val iterationStartTime = System.nanoTime() - instr.map(_.logNumFeatures(centers(0)(0).vector.size)) + instr.foreach(_.logNumFeatures(centers(0)(0).vector.size)) // Execute iterations of Lloyd's algorithm until all runs have converged while (iteration < maxIterations && !activeRuns.isEmpty) { |