码迷,mamicode.com
首页 > 编程语言 > 详细

数组去重

时间:2017-08-07 15:22:41      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:ash   bsp   length   sem   util   size   add   nbsp   static   

数组去重
/**
* 数组去重
* @param str
* @return
*/
public static String[] repeat(String[] str){
HashSet<String> set = new HashSet<String>();
if(!StringUtils.isEmpty(str)){
for(int i = 0;i<str.length;i++){
set.add(str[i]);
}
return (String[])set.toArray(new String[set.size()]);
}
 
return null;
}

数组去重

标签:ash   bsp   length   sem   util   size   add   nbsp   static   

原文地址:http://www.cnblogs.com/ameizai/p/7299026.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!