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
Post a Comment