Scala версии 2.11.8
Java версии 1.8
Код: Выделить всё
try(Stream stream = Files.lines(Paths.get("somefile.txt"))){
stream.forEach(System.out::println); // will do business process here
}catch (IOException e) {
e.printStackTrace(); // will handle failure case here
}
Не знаю, в чем проблема. Я новичок в использовании Java NIO, поэтому буду очень благодарен за любую помощь.
Подробнее здесь: https://stackoverflow.com/questions/398 ... with-scala
Мобильная версия