Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In the preceding sections, you saw how to work with arrays just like you would in Java or C++. But in Scala, you can go further. It is very easy to take an array (or array buffer) and transform it in some way. Such transformations don’t modify the original array, but they yield a new one.
Use a for comprehension like this: