I am trying to use pattern matching on a List of objects. The method takes in queue: List[ScheduleChangeEvent]
. ScheduleChangeEvent
is a sealed trait
with 4 different final case class
's. Therefore, depending on what type of ScheduleChangeEvent
the list contains, I need to do something different.
I implemented the following:
queue match {
case lsc: List[LocationSettingsChange] =>
...
case lwhc: List[LocationWorkHoursChange] =>
...
case tpc: List[TeamParameterChange] =>
...
case mptc: List[MemberPrimaryTeamChange] =>
...
}
However, I get the warning unreachable code [warn] case tpc: List[LocationWorkHoursChange] =>
. And no matter what the incoming queue is, it always goes to case lac
. I understand what the warning is, but I cannot understand why I am getting it.