scala – 为什么不设置实现PartialFunction?
发布时间:2020-12-16 10:07:48 所属栏目:安全 来源:网络整理
导读:Scala编程:综合循序渐进指南,第2版,第546页: In the inheritance hierarchy below Iterable you find three traits: Seq, Set,and Map. A common aspect of these three traits is that they all implement the PartialFunction trait with its apply and
Scala编程:综合循序渐进指南,第2版,第546页:
但是,此代码无法编译(尝试2.8.2和2.10.2): Set(1,2,3).isDefinedAt(1) 有错误: value isDefinedAt is not a member of scala.collection.immutable.Set[Int] 这是书中的错误吗? 解决方法
当然看起来像.走到Scala 2.5.0:
> 这似乎是明智的:设置从对象到布尔值的映射,因此它始终定义(成员为true,非成员为false). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |