Initializing Generic Variables in Scala -


How can I declare a generic variable in Scale (or to start any value) without initializing it Am I

def foo [T] {var t: T = ???? // try _, null t}
  def foo [T] {var t: T = Null.asInstanceOf [T] t}  

And, if you do not like the function involved, you can reduce it in this way:

 < Code> // Import your scope into case class init (): Init deaf Init Tot [T] (I: Init): T = {null.asInstanceOf [T]} // Then DefF [T] {Var t: T = Init () t}  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -