int a[] = {3, 10, 4, 2, 8};
int[] b = {10, 4, 12, 3, 23, 1, 8};
List<Integer> aList = Arrays.asList(a);
List<Integer> bList = Arrays.asList(b);
aList.retainsAll(bList);
System.out.println(" a intersection b "+aList);
Reference:
http://stackoverflow.com/questions/12919231/finding-the-intersection-of-two-arrays
No comments:
Post a Comment