public static <T>Collection<T> intersection(Collection<T> c1,Collection<T> c2){
  Set<T> set1=new HashSet<>(c1);
  set1.retainAll(new HashSet<>(c2));
  return set1;
}

public static < T > Collection < T > intersection ( Collection < T > c1 , Collection < T > c2 ) { Set < T > set1 = new HashSet < > ( c1 ) ; set1 . retainAll ( new HashSet < > ( c2 ) ) ; return set1 ; }
returns the intersection of the given collections .
