Arrays.asList()可以在这里解决问题。
String[] words = {"ace", "boom", "crew", "dog", "eon"};List<String> wordList = Arrays.asList(words);要转换为Set,您可以执行以下操作
Set<T> mySet = new HashSet<T>(Arrays.asList(words));

Arrays.asList()可以在这里解决问题。
String[] words = {"ace", "boom", "crew", "dog", "eon"};List<String> wordList = Arrays.asList(words);要转换为Set,您可以执行以下操作
Set<T> mySet = new HashSet<T>(Arrays.asList(words));