how to find union in java

Solutions on MaxInterview for how to find union in java by the best coders in the world

showing results for - "how to find union in java"
Juan Manuel
03 Apr 2020
1 public static void findUnion(int arry1[],int arry1size,int arry2[],int arry2size){
2    	
3    	HashSet<Integer> hs=new HashSet<Integer>();
4    	
5    	for(int i=0;i<arry1size;i++){
6    		hs.add(arry1[i]);
7    	}
8    	for(int i=0;i<arry2size;i++){
9    		hs.add(arry2[i]);
10 
11    	}
12    	System.out.println(hs);
13    	
14    }
15