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, i.e. excludes it from the import:
import Predef.{println => _, _}
means
*Import all from
Predef
exceptprintln
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With