SPARK-2799 [CORE] Simplify some Scala operations for clarity, performance

For fun, here's a last minor suggestion for consideration before the 1.1 window closes.

There are a number of instances where Scala operations can be simplified, for clarity or even performance.

For example `getOrElse(null)` can be `orNull`. `filter(...).size` can be faster as `count(...)`. An expression like `!...someLongChain...isEmpty` can be `... .nonEmpty`. And so on.

These are from code inspections. The PR shows the changes broken down by type in separate commits. They should be quite safe.