private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyz";
SortedSet<Character> set= new TreeSet<Character>();
for (int i = 0; i < ALPHABET.length(); i++) {
set.add(new Character(ALPHABET.charAt(i)));
}
Run Code Online (Sandbox Code Playgroud)
我想用Java 8方式转换这个for循环.如果使用流可能会更好.输出将是包含Character的"set"对象.