2015-09-07 11:44:36 -06:00
|
|
|
|
// containers/UniqueWordsAlphabetic.java
|
2015-11-14 16:18:05 -08:00
|
|
|
|
// <20>2016 MindView LLC: see Copyright.txt
|
2015-06-15 17:47:35 -07:00
|
|
|
|
// Producing an alphabetic listing.
|
|
|
|
|
import java.util.*;
|
2015-11-11 20:20:04 -08:00
|
|
|
|
import onjava.*;
|
2015-06-15 17:47:35 -07:00
|
|
|
|
|
|
|
|
|
public class UniqueWordsAlphabetic {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
Set<String> words =
|
|
|
|
|
new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
|
|
|
|
words.addAll(
|
|
|
|
|
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, add, addAll, added, args, B, C, class, Collections,
|
|
|
|
|
com, containers, contains, containsAll, D, E, F, false,
|
|
|
|
|
from, G, H, HashSet, I, import, in, J, java, K, L, M, main,
|
|
|
|
|
mindviewinc, N, new, Output, Print, public, remove,
|
|
|
|
|
removeAll, removed, Set, set1, set2, SetOperations, split,
|
|
|
|
|
static, String, to, true, util, void, X, Y, Z]
|
2015-09-07 11:44:36 -06:00
|
|
|
|
*/
|