'toString' and 'mkString'
-
-
‘mkString’ is used in place of ‘toString’ in ‘ScoreAnalysis’ program. Any particular reason to use mkString or is it just to demonstrate various functions that are used for the same purpose?
-
We read a text file into an iterator.. Hence, if you perform toString(), it won’t return the contents of the file. It returns the string representation of the iterator object.
Then, mkString() will read the iterator & loop over the values and create the String based on the values.
- You must be logged in to reply to this topic.