diff options
author | carlmartin <carlmartinmax@gmail.com> | 2014-12-22 12:13:53 -0800 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2014-12-22 12:13:53 -0800 |
commit | 1d9788e42ec96407bd63da8f2a2abebc7253c671 (patch) | |
tree | fb71a4d72d5cca615639865c51a5296c9202d039 /examples/src | |
parent | 8773705fd4ab167bb06bee7f274b337560e3c293 (diff) | |
download | spark-1d9788e42ec96407bd63da8f2a2abebc7253c671.tar.gz spark-1d9788e42ec96407bd63da8f2a2abebc7253c671.tar.bz2 spark-1d9788e42ec96407bd63da8f2a2abebc7253c671.zip |
[Minor] Improve some code in BroadcastTest for short
Using
val arr1 = (0 until num).toArray
instead of
val arr1 = new Array[Int](num)
for (i <- 0 until arr1.length) {
arr1(i) = i
}
for short.
Author: carlmartin <carlmartinmax@gmail.com>
Closes #3750 from SaintBacchus/BroadcastTest and squashes the following commits:
43adb70 [carlmartin] Improve some code in BroadcastTest for short
Diffstat (limited to 'examples/src')
-rw-r--r-- | examples/src/main/scala/org/apache/spark/examples/BroadcastTest.scala | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/examples/src/main/scala/org/apache/spark/examples/BroadcastTest.scala b/examples/src/main/scala/org/apache/spark/examples/BroadcastTest.scala index 973049b95a..adecd93435 100644 --- a/examples/src/main/scala/org/apache/spark/examples/BroadcastTest.scala +++ b/examples/src/main/scala/org/apache/spark/examples/BroadcastTest.scala @@ -38,10 +38,7 @@ object BroadcastTest { val slices = if (args.length > 0) args(0).toInt else 2 val num = if (args.length > 1) args(1).toInt else 1000000 - val arr1 = new Array[Int](num) - for (i <- 0 until arr1.length) { - arr1(i) = i - } + val arr1 = (0 until num).toArray for (i <- 0 until 3) { println("Iteration " + i) |