public class UniquesDupes
{
private ArrayList<String> list;
public UniquesDupes(String input)
{
list = new ArrayList<String>();
String[] words = "abc cde fgh ijk".split(" ");
ArrayList<String> list = new ArrayList<String>(Arrays.asList(words));
}
public Set<String> getUniques()
{
Set<String> uniques = new TreeSet<String>();
for(String a:list)
{
uniques.add(a);
}
return uniques;
}
getuniques 不起作用,它编译并运行,但它没有添加到树集中,我不知道为什么