title: Return tail if list is not empty or return empty list
body: <p>From the list of emails I have to get 2 values:</p>
  
  <ul>
  <li>option of the head of the list</li>
  <li>list of the rest of them</li>
  </ul>
  
  <p>What is the idiomatic way to code this in scala? So far I have:</p>
  
  <pre><code>val primaryEmail = emails.headOption
  val conf = Map[String, Any](
    "email" -&gt; primaryEmail,
    "additionalEmails" -&gt; 
       primaryEmail.map(_ =&gt; emails.tail).getOrElse(List())
  )
  </code></pre>
  
  <p>EDIT: As to why there is <code>Any</code>: We use GSON for json serialization, and internally convert all collections to java collections and pass them to <a href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/JsonSerializationContext.html#serialize%28java.lang.Object%29" rel="noreferrer">jsonSerializationContext.serialize</a>, which have java.lang.Object as an argument, so <code>Any</code> suits us just fine.</p>