Java Utililty Methods Vector Intersect

List of utility methods to do Vector Intersect

Description

The list of methods to do Vector Intersect are organized into topic(s).

Method

Vectorintersection(Vector a, Vector b)
intersection
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);
return r;
...
Vectorintersection(Vector vectA, Vector vectB)

This method returns a Vector containing the intersection of the objects contained in vectA and vectB.

This method will always return a new, non-null Vector, even if vectA and/or vectB are null.

Hashtable workSetA = new Hashtable(), workSetB = new Hashtable(), resultSet = new Hashtable();
Vector result = new Vector();
Enumeration Enum;
Object item;
if (vectA != null) {
    Enum = vectA.elements();
    while (Enum.hasMoreElements()) {
        item = Enum.nextElement();
...