Skip to content

Instantly share code, notes, and snippets.

scala> val things: Seq[String] = Seq("asdf")
things: Seq[String] = List(asdf)
scala> things match { case hd :: tl => "not empty" ; case Nil => "empty" }
res1: String = not empty
scala> val things: Seq[String] = scala.collection.mutable.ArrayBuffer("asdf")
things: Seq[String] = ArrayBuffer(asdf)
scala> things match { case hd :: tl => "not empty" ; case Nil => "empty" }