[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
Yes, I understand the logic. My IDE does this automatically without having to write it out, and I suspect that is true of many if not all other devs. I also don't see this as common practice in other Scala code.  Still I'd be interested what other people think of this standard, specifically for `Boolean` args with default value.