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...
There is no fromPath
in Source
, just a fromFile
, which accepts a String path. Good luck on Coursera.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With