2021-05-08集合框架3.HashSet

package edu.xcdp;

import java.util.HashSet;

public class Demo03 {
    public static void main(String[] args) {
        // set 集合 : 确定性 无序性 互异性
        HashSet set = new HashSet<>();
        set.add("111");
        set.add("222");
        set.add("aaa");
        set.add("sdfdas");
        set.add("333");
        set.add("444");
        set.add("444");
        System.out.println(set);
        set.remove("444");
        System.out.println(set);

        for ( String s : set ) {
            System.out.println(s +"\t");
        }
    }
}

你可能感兴趣的:(2021-05-08集合框架3.HashSet)