package com.study;
import java.util.Set;
import java.util.HashSet;
import java.util.TreeSet;
public class TestSetCollection {
public void doSet() {
//Set接口 没有循序,且不可以重复.
Set set1= new HashSet();
set1.add(new String("zhudansheng set1"));
set1.add(new String("zhudansheng set2"));
set1.add(new String("zhudansheng set3"));
set1.add(new String("zhudansheng set3"));
set1.add(new String("zhudansheng set3"));
set1.add(new Boolean(true));
set1.add(new Boolean(false));
Set set2 = new TreeSet();
set2.add("tet Set1");
set2.add("tet Set1");
set2.add("tet Set1");
set2.add("tet Set1");
set2.add("tet Set2");
set2.add(new String("22222"));
System.out.println(set1);
System.out.println(set2);
}
public static void main(String []args) {
TestSetCollection testSet = new TestSetCollection();
testSet.doSet();
}
}