Quantcast
Channel: Blumenfeld & Maso, Inc. » Uncategorized
Viewing all articles
Browse latest Browse all 6

Scala: Importing a Package and Aliasing Some of the Members

$
0
0

I learned recently its easy to import a package in Scala while aliasing some of the package members. In my case, I had a few different imported packages each with a class/object named Hour. The following could be used to alias the Hour member while importing the whole package (“wildcard” import):

import com.somewhere.packageA.{Hour => A_Hour, _}
import com.somewhere.packageB.{Hour => B_Hour, _}
import com.somewhere.packageC.{Hour => C_Hour, _}

As one would expect, the type A_Hour within the scope of the import refers to com.somewhere.packageA.Hour, B_Hour to com.somewhere.packageB.Hour, etc.


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images