SPARK-3580: New public method for RDD's to have consistent way of obtain...

...ing the number of RDD partitions across languages.


Good point, although it's worth noting this was essentially ported directly from the python API (including the doc). Any doc changes should be consistent across both versions if possible.