[SPARK-3781] code format and little improvement

1. use scala recommended usage
2. method body's left bracket
3. parameter list format
4. explicit mutable collection, such as "new mutable.HashMap"
5. others
http://misto.ch/detecting-and-naming-boolean-parameters/
scala plugin tips: Detecting and Naming Boolean Parameters