Here you can find the source of sizeOfIntersection(Collection> a, Collection> b)
public static int sizeOfIntersection(Collection<?> a, Collection<?> b)
//package com.java2s; import java.util.Collection; public class Main { public static int sizeOfIntersection(Collection<?> a, Collection<?> b) { int count = 0; for (Object o : a) if (b.contains(o)) count++;/* w ww.j a va2s . c o m*/ return count; } }