@dhg is true, and here is a little more detail on why.
The code in your example makes calls to Source.fromFile, which returns a BufferedSource. Then you call getLines, which returns an iterator. This iterator is then output and stored as data.
Calling toArray on an Iterator will give you an array of strings as you want.
source share