Set集合是Collection接口的子接口,没有对Collection接口进行扩展,里面不允许存在重复的内容;

package com.xuyigang1234.chp06.sec01;

import java.util.HashSet;

public class TestHashSet {
    public static void main(String[] args) {
        HashSet<String> hs= new HashSet<String>();
        hs.add("11");
        hs.add("12");
        hs.add("13");
        hs.add("14");
        
        for(String s:hs) {
            System.out.println(s);
        }
        
    }

}
11
12
13
14