In Java8, how can I form a Stream of String out of the scanner read results?
InputStream is = A.class.getResourceAsStream("data.txt");
Scanner scanner = new Scanner(new BufferedInputStream(is), "UTF-8");
while (scanner.hasNextLine()) {
System.out.println(scanner.nextLine());
}
That is turn a scanner into a stream which I would like to iterate using forEach.