Tuesday, 20 August 2013

When lazy val is initialized?

When lazy val is initialized?

When in Scala lazy val initialized? In other words does following code
have some benefits from declaring variables as lazy?
lazy val xOption = table.get(x)
lazy val yOption = table.get(y)
lazy val xyOption = table.get(x + y)
(xOption, yOption, xyOption) match { ... }
Does match operator (method) initialize all three variables?

No comments:

Post a Comment