目录  待去重列表 HashSet去重(不保证顺序) TreeSet去重(不保证顺序) LinkedHashSet去重(保证顺序) 遍历List去重(保证顺序) Java8中Stream流处理(保证顺序) 参考文章   
 
List < String > =  new  ArrayList < > ( ) ; 
list. add ( "Tom" ) ; 
list. add ( "Jack" ) ; 
list. add ( "Steve" ) ; 
list. add ( "Tom" ) ; System . out. println ( list) ; 
Set < String > =  new  HashSet < > ( list) ; 
List < String > =  new  ArrayList < > ( set) ; System . out. println ( newList) ; 
Set < String > =  new  TreeSet < > ( list) ; 
List < String > =  new  ArrayList < > ( set) ; System . out. println ( newList) ; 
Set < String > =  new  LinkedHashSet < > ( list) ; 
List < String > =  new  ArrayList < > ( set) ; System . out. println ( newList) ; 
List < String > =  new  ArrayList < > ( ) ; 
for  ( String  value :  list)  { if ( ! newList. contains ( value) ) { newList. add ( value) ; } 
} System . out. println ( newList) ; 
List < String > =  list. stream ( ) . distinct ( ) . collect ( Collectors . toList ( ) ) ; System . out. println ( newList) ; 
List 去重的 6 种方法,这个方法最完美!