scala - scala 的 List.cons 方法在哪里?
问题描述
Scala 的 List.cons 在哪里?我无法在我的设置中找到它。
scala> List.::
<console>:12: error: value :: is not a member of object List
List.::
^
scala> List.cons
<console>:12: error: value cons is not a member of object List
List.cons
^
如果我键入 List.[tab] 来自动完成,我会得到
scala> List.
!= -> ReusableCBF canBuildFrom ensuring fill hashCode ne notifyAll tabulate wait
## == apply concat eq formatted isInstanceOf newBuilder range toString →
+ GenericCanBuildFrom asInstanceOf empty equals getClass iterate notify synchronized unapplySeq
解决方案
它在类上List
,而不是在对象上List
。
scala> List(1).::
def ::[B >: Int](elem: B): List[B]
推荐阅读
- google-cloud-platform - 在 GCE 中将文件从区域存储桶移动到多区域存储桶
- facebook-login - java.lang.ClassCastException: android.app.ApplicationPackageManager$ResourceName
- java - 从字符串 s 打印给定大小 k 的字典最小和最大子字符串
- spring-boot - 在 application.yml 的属性中找不到键 [http-client.timers['http-get'].name] 的属性
- git - 无法忽略 git 存储库中的日志文件
- python - 如何遍历 AutoCAD 图形的实体?
- angular - Angular 材质 UI 连续显示选项卡内容
- php - cron-job.org cron 的 url 转换问题
- node.js - Alexa音频技能在播放音频时显示进度条
- python-3.x - 从outlook邮件中提取抄送列表完整邮件地址