I want to implement init method kind of functionality in my object. for ex , my object structure is as follows:
object MyObject {
var set: Set[String] = _
var map : Map[String, String] =_
var list: List[Integer] =_
init()
def init() {
// read external file and initialze variables
set = ..
map = ..
list = ..
}
}
I have defined a init method and called init method from object itself. Is this a correct way to do it or can i achieve the same functionality through any better way?