public class SimpleCollection {
public static void main(String[] args) {
String[] words ={"aa","bb","aa","cc","aa"};
TreeSet a=new TreeSet();
for(int i = 0; i < words.length; i++)
a.add(words[i]);
Iterator it = a.iterator();
while(it.hasNext())
System.out.println(it.next());
}
}
a就是没有重复元素的集合了。