public static void addNew(Vector to, Vector all) { synchronized (to) { for (int i = 0; i < all.size(); ++i) { if (0 <= Util.getIndex(to, all.elementAt(i))) continue; to.addElement(all.elementAt(i)); } } }
public static void removeAll(Vector to, Vector all) { synchronized (to) { int current = 0; for (int index = 0; index < to.size(); ++index) { if (0 <= Util.getIndex(all, to.elementAt(index))) continue; if (current < index) { to.setElementAt(to.elementAt(index), current); current++; } } if (current < to.size()) to.setSize(current); } }