public static FeatureVector intersection(FeatureVector v1, FeatureVector v2) {
    	FeatureVector result = new FeatureVector();
    	v1.idSort();
    	v2.idSort();
    	Iterator<Feature> it1 = v1.iterator();
    	Iterator<Feature> it2 = v2.iterator();
    	Feature f1 = null;
    	Feature f2 = null;
    	if (it1.hasNext())
    		f1 = it1.next();
    	if (it2.hasNext())
    		f2 = it2.next();
    	while (true) {
    		if (f2.identifier() == f1.identifier()) {
    			result.add(new Feature(f1.identifier));
    			if (it1.hasNext())
    				f1 = it1.next();
    			else 
    				break;
    			if (it2.hasNext())
    				f2 = it2.next();
    			else
    				break;
    		}
    		else if (f2.identifier() < f1.identifier()) {
    			if (it2.hasNext())
    				f2 = it2.next();
    			else
    				break;
    		}
    		else { // f1 < f2
    			if (it1.hasNext())
    				f1 = it1.next();
    			else 
    				break;
    		}
    	}
    	result.trimToSize();
    	return result;
    }