What does the arrow in an import statement do?
I've found the the following import
in some scala
:
import Predef.{println => _, _}
What does the =>
do?
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, ie excludes it from the import:
import Predef.{println => _, _}
means
*Import all from Predef
except println
上一篇: 关于Scala的问题
下一篇: 进口报表中的箭头是做什么的?