del*_*ber 3 scala pattern-matching
我的代码如下
val hash = new HashMap[String, List[Any]]
hash.put("test", List(1, true, 3))
val result = hash.get("test")
result match {
case List(Int, Boolean, Int) => println("found")
case _ => println("not found")
}
Run Code Online (Sandbox Code Playgroud)
我希望打印出"找到"但打印出"未找到".我正在尝试匹配任何具有Int,Boolean,Int三种元素的List
| 归档时间: |
|
| 查看次数: |
264 次 |
| 最近记录: |