Added patterns for initialization for Scala #2297

 - [x] port to Java docs as well