Im attempting to match a List to certain actions, based on the inner elements of the list, specifically, their types:
def car1 = new Car[Racing] {}
def car2 = new Car[Pickup] {}
var myCars = List(car1,car2)
myCars match {
case Racing :: Pickup => print("your first car is awesome but not your 2nd!"
}
Obviously, the case above is an attempt at pseudocode describing what I'm trying to do, however, it fails.
What is the idiomatic way to match against the types of values that are present in a collection in scala?