Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我阅读了一些 Java 源代码,其中包括 Scala 源代码。
我发现Nil.$colon$colon(Object arg)
Nil.$colon$colon(Object arg)
关键词是什么$colon意思?这条线是什么意思?
$colon
$colon 是符号 : 的修饰符。由于 : (和其他字母)在 java 中是用于方法名称的非法字母,但在 scala 中是允许的,因此需要一种策略将其编码为合法名称。因此,$冒号
在这里,您的代码转换为 arg :: Nil,它将 arg 添加到空列表中,构造一个以 arg 作为单个元素的 List。