Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala: shorthand to import object Foo._ and trait Bar

Have a recurring situation, petty I know, but I'd like to consolidate the following:

import com.company.model.FooDAO
import com.company.model.FooForm._

into something like:

import com.company.model.{FooDAO, FooForm._}

the above 1-liner does not compile, however.

The best I've managed is:

import com.company.model.FooDAO, com.company.model.FooForm._

Scala being Scala, I assume the compact form above is possible...

like image 501
virtualeyes Avatar asked Jul 23 '12 21:07

virtualeyes


1 Answers

You can write this:

import com.company.model.{FooDAO, FooForm}, FooForm._
like image 186
om-nom-nom Avatar answered Nov 16 '22 08:11

om-nom-nom