我在某些import
中找到了以下scala
:
import Predef.{println => _, _}
=>
做了什么?
答案 0 :(得分:5)
Generally =>
in an import
allows you to alias an existing name into an alternate name:
import scala.{Int => i32}
This would allow you to use i32
in place of Int
Further, importing _
imports all symbols into the current namespaces.
Now, aliasing a name into _
, however does the opposite, i.e. excludes it from the import:
import Predef.{println => _, _}
means
*Import all from
Predef
exceptprintln