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

Method main

collections/UniqueWords.java:9–19  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

7
8public class UniqueWords {
9 public static void
10 main(String[] args) throws Exception {
11 List<String> lines = Files.readAllLines(
12 Paths.get("SetOperations.java"));
13 Set<String> words = new TreeSet<>();
14 for(String line : lines)
15 for(String word : line.split("\\W+"))
16 if(word.trim().length() > 0)
17 words.add(word);
18 System.out.println(words);
19 }
20}
21/* Output:
22[A, B, C, Collections, D, E, F, G, H, HashSet, I, J, K,

Callers

nothing calls this directly

Calls 4

splitMethod · 0.80
trimMethod · 0.80
getMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected