set union java
set1.retainAll(set2); // Intersection
set union java
set1.retainAll(set2); // Intersection
set union java
set1.addAll(set2); // Union
how to find union in java
public static void findUnion(int arry1[],int arry1size,int arry2[],int arry2size){
HashSet<Integer> hs=new HashSet<Integer>();
for(int i=0;i<arry1size;i++){
hs.add(arry1[i]);
}
for(int i=0;i<arry2size;i++){
hs.add(arry2[i]);
}
System.out.println(hs);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us