title: Scala Set match case
body: <p>I'm learning scala and as the best training I'm transforming my old Java Algorithms to functional programming style. I have the following code: </p>
  
  <pre><code>def test(originalSet: Set[Int]):Boolean = originalSet match {
      case Set()  =&gt; true
      case x::y =&gt; false
    } 
  </code></pre>
  
  <p>This code works fine for Lists, but for Sets it gives me the following compilation errors:</p>
  
  <pre><code>  - value Set is not a case class constructor, nor does it have an unapply/unapplySeq 
           method
  </code></pre>
  
  <p>and </p>
  
  <pre><code>- constructor cannot be instantiated to expected type; found : scala.collection.immutable.::[B] required: 
       scala.collection.immutable.Set[Int]
      - constructor cannot be instantiated to expected type; found : scala.collection.immutable.::[B] required: 
       scala.collection.immutable.Set[Int]
  </code></pre>
  
  <p>What is the problem? How can I test the case that the Set is empty? and how can I the other case when set has head and tail? </p>