title: How to check whether element exsits or not in a List[Any] using Scala
body: <p>I have a list like the following:</p>
  
  <pre><code>val map_temp =
    List(
      (List("SRC_123","SRC_999"),"TRGT_123"),
      (List("SRC_456"),"TRGT_456"),
      (List("SRC_789"),"TRGT_789"),
      (List("SRC_888"),"TRGT_888"),
    )
  </code></pre>
  
  <p>I want to check whether <code>SRC_999</code> exists in it.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>map_temp.foreach {
    case(key, value) =&gt;
      if (key.contains("SRC_999")) {
        print("yes exists")
      }
  }
  </code></pre>
  
  <p>This causes the following error</p>
  
  <pre><code>error: value contains is not a member of Any
  case(key:Any, value) =&gt; if(key.contains("SRC_99"))
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code>map_temp.foreach(a =&gt; if(a._1.contains("SRC_999")))
  </code></pre>
  
  <p>But this causes the following error:</p>
  
  <pre><code>error: value contains is not a member of Any
  mapped.foreach(a =&gt; print(a._1.contains("SRC_999")))
  </code></pre>
  
  <p>How can I solve this?</p>