// 方法: String转换为Set<String> String[] ss = s.split(""); Set<String> set = new HashSet<>(Arrays.asList(ss)) 结果如下: