1.

How can you import all classes from a specific package excluding a few classes?

Answer»

Scala import provides a NUMBER of flexibilities. We can EXCLUDE certain CLASSES while importing the whole package:

import com.xyz.abc.{Abc => _, _} // excluding the class Abc

Also, it’s POSSIBLE while importing that we can rename the existing classes. 

import com.xyz.abc.{Abc => Pqr, _} // renaming the class Abc


Discussion

No Comment Found