首页 > 代码库 > Set与list测试

Set与list测试

public class SetTest {
    public static void main(String[] args) {
        Set set = new HashSet();
        List<String> list = new ArrayList<String>();
        list.add("123");
        list.add("123");
        set.addAll(list);
        Iterator ite = set.iterator();
        while (ite.hasNext()) {
            System.out.println(ite.next());
        }

    }
}