Reputation: 3353
Again Scala basic operations are making my life painful :D. So I have to read lines from file...just a trivial I/O operation.
In every example on internet they are doing:
import scala.io.Source
for(line <- Source.fromPath("integerArray.txt").getLines())
println(line)
But my IntelliJ is throwing error : value fromPath is not a member of object scala.io.Source.
Does anyone knows what is problem here? ... I have installed last version of Scala few months ago and IntelliJ Scala plugin is also up to date so I doubt this might be a reason...
Upvotes: 7
Views: 7124
Reputation: 39577
There was Source.fromPath
around 2.8. Briefly.
What, you're not using this version?
It was removed here, with "Review by community."
See? We just weren't paying attention.
Upvotes: 4
Reputation: 29528
There is no fromPath
in Source
, just a fromFile
, which accepts a String path. Good luck on Coursera.
Upvotes: 10