Scala import multiple packages

package, scala

Solution

The shortest form I can come up is:

import com.foo._, bar._, baz._, qux._

For example:

import scala.collection.mutable._, PriorityQueue._, ArrayBuffer._

EDIT

Perhaps, you want to use only some particular things, as @alex23 pointed out, so you may write:

import com.foo.{foo, bar, baz}, bar._, baz._, qux._

Problem

I've got some Scala classes and objects, in their own packages. Each package has a package object defining some implicits, so for example `import com.foo.bar._` imports all implicits and classes from the `bar` package What I'd like to know is, is there a way to define an "umbrella" import, say `com.foo.all`, such that ``` import com.foo.all._ ``` is equivalent to ``` import com.foo.bar._ import com.foo.baz._ import com.foo.qux._ ... ``` I can understand that this might be a little unclear, but if I we consider the case where I have a large number of my own packages, this would clearly be more concise.

Original source