OnJava8-Examples/containers/UniqueWords.java

21 lines
672 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// containers/UniqueWords.java
2015-06-15 17:47:35 -07:00
// <20>2015 MindView LLC: see Copyright.txt
import java.util.*;
import com.mindviewinc.util.*;
public class UniqueWords {
public static void main(String[] args) {
Set<String> words = new TreeSet<>(
new TextFile("SetOperations.java", "\\W+"));
System.out.println(words);
}
2015-09-07 11:44:36 -06:00
}
/* Output:
2015-06-15 17:47:35 -07:00
[A, B, C, Collections, D, E, F, G, H, HashSet, I, J, K, L,
M, N, Output, Print, Set, SetOperations, String, X, Y, Z,
add, addAll, added, args, class, com, containers, contains,
containsAll, false, from, import, in, java, main,
mindviewinc, new, print, public, remove, removeAll,
removed, set1, set2, split, static, to, true, util, void]
2015-09-07 11:44:36 -06:00
*/