Created
October 16, 2018 15:17
-
-
Save bmaggi/8b5fac0bd48f46681eed9d61898ad7fc to your computer and use it in GitHub Desktop.
In Scala: Pattern Matching not working with List[T]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class A() | |
case class B() | |
val b1 = B() | |
val b2 = B() | |
val sB = Seq[B](b1,b2) | |
sB match { | |
case _:Seq[A] => println("niet") | |
case _:Seq[B] => println("da") | |
case _ => println("?") | |
} | |
// result niet ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment