scala> val li = Source.fromFile(file).getLines
^
warning: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method getLines,
or remove the empty argument list from its definition (Java-defined methods are exempt).
In Scala 3, an unapplied method like this will be eta-expanded into a function.
val li: Iterator[String] = <iterator>
scala> val li2 = li.toList
val li2: List[String] = List([email protected], ...
scala> for (x<- li) println(x)
(null)
my questions are:
- warning: Auto-application to
()
is deprecated. what does this mean? how to remove it? - why the value li get cleared after it was assigned to li2?
Thank you a lot.