Reputation: 19758
I have the following Akka actor code:
class GenerateBoardActor extends Actor {
import GenerateBoardActor._
def receive = {
case GenerateBoard(configuration: Seq[Configuration.PiecesConfigSpec]) => {
sender ! Board(configuration: _*)
}
case generateBoard: GenerateBoard => {
sender ! Board(generateBoard.configuration: _*)
}
}
}
object GenerateBoardActor {
case class GenerateBoard(configuration: Configuration.PiecesConfigSpec*)
}
I'm thinking the two case clauses ought to be equivalent, but only the second one is ever matched. Is it possible to use the syntax of the first clause in order to match a case class with varargs? Or what is the correct syntax for the first clause?
Upvotes: 2
Views: 265