public static String [ ] union ( String [ ] arr1 , String [ ] arr2 ) { Set < String > set = new HashSet < String > ( ) ; for ( String str : arr1 ) { set . add ( str ) ; } for ( String str : arr2 ) { set . add ( str ) ; } String [ ] result = { } ; return set . toArray ( result ) ; }
Arr1 union Arr2