title: Comparing items in two lists
body: <p>I have two lists : <code>List(1,1,1) , List(1,0,1)</code></p>
  
  <p>I want to get the following : </p>
  
  <ol>
  <li><p>A count of every element that contains a 1 in first list and a 0 in the corresponding list at same position and vice versa.
  In above example this would be 1 , 0 since the first list contains a 1 at middle position and second list contains a 0 at same position (middle).</p></li>
  <li><p>A count of every element where 1 is in first list and 1 is also in second list.
  In above example this is two since there are two 1's in each corresponding list. I can get this using the intersect method of class List.</p></li>
  </ol>
  
  <p>I am just looking an answer to point 1 above. I could use an iterative a approach to count the items but is there a more functional method ?
  Here is the entire code : </p>
  
  <pre><code>class Similarity {
    def getSimilarity(number1: List[Int], number2: List[Int]) = {
      val num: List[Int] = number1.intersect(number2)
      println("P is " + num.length)
    }
  }
  
  object HelloWorld {
    def main(args: Array[String]) {
      val s = new Similarity
      s.getSimilarity(List(1, 1, 1), List(1, 0, 1))
    }
  }
  </code></pre>