title: pattern match on a list to check empty
body: <p>I want to check if a list is empty using pattern matching</p>
  
  <pre><code>val simplelist: List[Char] = List('a', 'b', 'c', 'd')
  
  def test(l:List[Char]):Unit= l.map(d =&gt; print(d))
  simplelist match {
     case x :: xs =&gt;
       test(xs)
     case Nil=&gt;  log.info("empty")
  }
  </code></pre>
  
  <p>Output is bcd and not abcd</p>