Here you can find the source of intersection(Vector a, Vector b)
public static Vector intersection(Vector a, Vector b)
//package com.java2s; import java.util.*; public class Main { public static Vector intersection(Vector a, Vector b) { Vector r = new Vector(); for (int i = 0; i < a.size(); i++) { for (int j = 0; j < b.size(); j++) { if (a.elementAt(i).equals(b.elementAt(j))) r.add(a);// w ww. jav a2s. com } } return r; } }