How do I exclude/rename some classes from import in Scala?

后端 未结 1 887
醉酒成梦
醉酒成梦 2020-12-10 00:18

Language FAQ says

import scala.collection.mutable.{_, Map => _, Set => _}

should import all classes from package scala.collect

相关标签:
1条回答
  • 2020-12-10 01:08

    The _ has to be put at the end - not at the beginning:

    Exclude Map and Set from the import

    import scala.collection.mutable.{Map => _, Set => _, _}
    

    Exclude Set and rename Map to ScalaMutableMap

    import scala.collection.mutable.{Map=>ScalaMutableMap, Set => _, _}
    

    See the detailed info in Scala Refererence, page 50, paragraph 4.7

    0 讨论(0)
提交回复
热议问题