title: How to qualify methods as static in Scala?
body: <p>I have a class</p>
  <pre><code>class MyClass {
    def apply(myRDD: RDD[String]) {
      val rdd2 = myRDD.map(myString =&gt; {
        // do String manipulation
      }
    }
  }
  
  object MyClass {
  
  }
  </code></pre>
  <p>Since I have a block of code performing one task (the area that says <code>&quot;do String manipulation&quot;</code>), I thought I should break it out into its own method. Since the method is not changing the state of the class, I thought I should make it a <code>static</code> method.</p>
  <p>How do I do that?</p>
  <p>I thought that you can just pop a method inside the companion object and it would be available as a static class, like this:</p>
  <pre><code>object MyClass {
    def doStringManipulation(myString: String) = {
      // do String manipulation
    }
  }
  </code></pre>
  <p>but when I try <code>val rdd2 = myRDD.map(myString =&gt; { doStringManipulation(myString)})</code>, scala doesn't recognize the method and it forces me to do <code>MyClass.doStringManipulation(myString)</code> in order to call it.</p>
  <p>What am I doing wrong?</p>