Monday, 25 May 2015

How to Remove List From Vector

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

public class RemoveList {
      public static void main(String[] args) {
             Vector<String> vector = new Vector<String>();
             //add element in vector
             // print vector
             System.out.println("Vector = "+vector);
             List<String> list = new ArrayList<String>();
             System.out.println("list is = "+list);
              * Removes from this Vector all of its
              *  elements that are contained in the
              *  specified Collection.
             System.out.println("Vector after remove list = "+vector);


Vector = [cricket, hockey, football, tennish]

list is = [hockey, tennish, apple, java]

Vector after remove list = [cricket, football]

No comments:

Post a Comment