Added patterns for initialization for Scala #2297

 - [ ] port to Java docs as well