LinkedNestBlog

ArrayList 중복 제거

by jinwon lee

ArrayList 중복 제거

 

ref] http://kr.blog.yahoo.com/hyungsekk/1453

      http://yhw720.tistory.com/22

      http://www.ezslookingaround.com/blog/tech/?no=1676 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public static void main(String[] args) throws Exception {    
    List alarmList = new ArrayList();  
    alarmList.add("1011");  
    alarmList.add("1012");  
    alarmList.add("1011");  
    alarmList.add("1014");  
    alarmList.add("1014");  
    alarmList.add("1011");    
 
    HashSet hashSet = new HashSet(alarmList);    
    List alarmerList2 = new ArrayList(hashSet);    
    FCAlarm aa = null;  
 
    System.out.println("사이즈: "+alarmerList2.size());  
 
    for(int i=0 ; i < alarmerList2.size() ; i++){   
        System.out.println(i+" 테스트 :"+alarmerList2.get(i).toString());  
    } 
}
cs