Java Vector Difference difference(Vector a, Vector b)

Here you can find the source of difference(Vector a, Vector b)

Description

difference

License

Open Source License

Declaration

public static Vector difference(Vector a, Vector b) 

Method Source Code

//package com.java2s;

import java.util.*;

public class Main {
    public static Vector difference(Vector a, Vector b) {
        Vector r = new Vector();

        for (int i = 0; i < a.size(); i++) {
            boolean inB = false;
            for (int j = 0; j < b.size(); j++) {
                if (a.elementAt(i).equals(b.elementAt(j))) {
                    inB = true;//from   w ww  . j  a  v a 2  s . c om
                    break;
                }
            }
            if (!inB)
                r.add(a.elementAt(i));
        }
        return r;
    }
}

Related

  1. difference(Vector vectA, Vector vectB)
  2. minus(Vector vectA, Vector vectB)