title: SparkContext parallelize lazy behavior - unexplained
body: <p>According to Spark source code comments.  </p>
  
  <p>SparkContext.scala has</p>
  
  <pre><code>  /** Distribute a local Scala collection to form an RDD.
     *
     * @note Parallelize acts lazily. If `seq` is a mutable collection and is altered after the call
     * to parallelize and before the first action on the RDD, the resultant RDD will reflect the
     * modified collection. Pass a copy of the argument to avoid this.
     * @note avoid using `parallelize(Seq())` to create an empty `RDD`. Consider `emptyRDD` for an
     * RDD with no partitions, or `parallelize(Seq[T]())` for an RDD of `T` with empty partitions.
     */
  </code></pre>
  
  <p>So, I thought I'd do a simple test.</p>
  
  <pre><code>scala&gt; var c = List("a0", "b0", "c0", "d0", "e0", "f0", "g0")
  c: List[String] = List(a0, b0, c0, d0, e0, f0, g0)
  
  scala&gt; var crdd = sc.parallelize(c)
  crdd: org.apache.spark.rdd.RDD[String] = ParallelCollectionRDD[0] at parallelize at &lt;console&gt;:26
  
  scala&gt; c = List("x1", "y1")
  c: List[String] = List(x1, y1)
  
  scala&gt; crdd.foreach(println)
  [Stage 0:&gt;                                                          (0 + 0) / 8]d0
  a0
  b0
  e0
  f0
  g0
  c0
  
  scala&gt;
  </code></pre>
  
  <p>I was expecting <code>crdd.foreach(println)</code> to output "<code>x1</code>" and "<code>y1</code>", based on the lazy behavior of <code>parallelize</code>.</p>
  
  <p>What am I doing wrong?</p>