首页 > 其他 > 详细

【去除集合中字符串的重复值-3】

时间:2019-01-31 12:26:42      阅读:157      评论:0      收藏:0      [点我收藏+]
package com.yjf.esupplier.common.test;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;

/**
 * @author shusheng
 * @description
 * @Email shusheng@yiji.com
 * @date 2018/12/12 17:11
 */
public class ArrayListDemo2 {

    public static void main(String[] args) {

        ArrayList array = new ArrayList();
        array.add("hello");
        array.add("world");
        array.add("world");
        array.add("world");
        array.add("java");
        array.add("java");
        array.add("hello");
        array.add("hello");
        array.add("software");

        HashSet hs = new HashSet();
        hs.addAll(array);

        Iterator it = hs.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }

    }

}

 

【去除集合中字符串的重复值-3】

原文:https://www.cnblogs.com/zuixinxian/p/10340840.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!