how to use pattern match get a nonEmpty list in scala?
<p>I'm use <code>case x :: Nil =&gt; ...</code> attempt to make sure the list is nonEmpty, but it just match single element list.How can I use pattern match get a nonEmpty list?</p>

<p><strong>UPDATED</strong><br>
I'm sorry,it seems I lose something, there is a special scene use the match inner,</p>

<pre><code>object AccountResult{
  def unapply(account: AccountResult): Option[(String, List[String])] = ???
}

//ignore accountResult define please 
accountResult match {
  case AccountResult(_, x :: _) =&gt; ... 
}
</code></pre>

<p>how can I match accountResult which List[String] (x :: _) value is not Nil? and then get the matched List[String] value</p>