Scala apply method