How to find does vector contains all list elements or not?

Below example shows how to find whether a vector contains list of objects or not. The method containsAll() helps us to find the match.

containsAll(Collection<?> c)

Returns true if this Vector contains all of the elements in the specified Collection.

package vector;

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

public class VectorElementCheck {
  public static void main(String a[]){
        Vector<String> vct = new Vector<String>();
        vct.add("India");
        vct.add("Autralia");
        vct.add("New Zealand");
        vct.add("England");
        List<String> list = new ArrayList<String>();
        list.add("Autralia");
        list.add("England");
        System.out.println("Does vector contains all list elements?: "+vct.containsAll(list));
        list.add("Pakistan");
        System.out.println("Does vector contains all list elements?: "+vct.containsAll(list));
    }
}

Output:

Does vector contains all list elements?: true
Does vector contains all list elements?: false

The only business I know is learning new technology and spreading the knowledge. I believe sharing is learning. This is my prime reason to build this site.
I welcome and value your comments, suggestions and corrections.

244total visits,1visits today

The only business I know is learning new technology and spreading the knowledge. I believe sharing is learning. This is my prime reason to build this site. I welcome and value your comments, suggestions and corrections.