MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / stream

Method stream

streams/FileToWords.java:10–16  ·  view source on GitHub ↗
(String filePath)

Source from the content-addressed store, hash-verified

8
9public class FileToWords {
10 public static Stream<String> stream(String filePath)
11 throws Exception {
12 return Files.lines(Paths.get(filePath))
13 .skip(1) // First (comment) line
14 .flatMap(line ->
15 Pattern.compile("\\W+").splitAsStream(line));
16 }
17}

Callers 5

mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95

Calls 1

getMethod · 0.65

Tested by 1

mainMethod · 0.76