如何完成val的声明:
case class Employee(id: String, name: String)
case class Jobsite(title: String)
val list: ::[Employee :: JobSite] = // complete me
这是为了帮助理解如何迭代它,比如list.foreach{...}
。
编辑:我以不同的方式重申了同样的问题。
答案 0 :(得分:2)
case class Employee(id: String, name: String)
case class Jobsite(title: String)
val list = (Employee("1", "Jake"), Jobsite("Facebook")) :: (Employee("1", "Ashton"), Jobsite("Google")) :: (Employee("1", "Kirk"), Jobsite("Typesafe")):: Nil
list.foreach(println)
似乎这就是你所要求的。