title: how to get value from list based on condition in scala
body: <p>I have a following <code>val headers: List[HttpHeader]</code>:</p>
  
  <pre><code>val someList = List(Server: Apache-Coyote/1.1, Set-Cookie: 
  JSESSIONID=879sdf97f98s7f9a87dgssa7987; Path=/userApi/; HttpOnly)
  </code></pre>
  
  <p>Now I want to get <code>879sdf97f98s7f9a87dgssa7987</code> from the above list. So I did the following:</p>
  
  <pre><code>someList.iterator.filter(_.name.equals("Set-Cookie")).map { x =&gt; x.value }
  </code></pre>
  
  <p>But this doesn't gives that particular value from list.</p>