1package bola;
2
3import java.io.File;
4import java.io.IOException;
5import java.nio.file.Files;
6import java.util.stream.Collectors;
7import java.util.stream.Stream;
8import java.util.List;
9
10public class LerArquivo {
11
12 private static Stream<Integer> ints(String s) {
13 return Stream.of(s.replace(";", "").split(" ")).map(Integer::parseInt);
14 }
15
16 public static List<Integer> leitura() throws IOException {
17 String path = "D:\\Conteudo\\teste.txt";
18 Stream<String> linhas = Files.readAllLines(new File(path).toPath()).stream();
19 return linhas.flatMap(LerArquivo::ints).collect(Collectors.toList());
20 }
21
22 public static void main(String[] args) throws IOException {
23 System.out.println(LerArquivo.leitura());
24 }
25}
26