11:41 pm - Saturday January 21, 2017

Vector Example Program for containsAll(Collection c)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

// Vector Example Program for containsAll(Collection c)
/**
@author: candidjava.com
@description: This program returns "true" if the vector contains all of the elements in the specified collection
otherwise returns false.
*/

import java.util.*;

public class ContainsAll {
public static void main(String[] args) {
Vector v = new Vector(); // Creating a new vector
// adding strings to the vector
v.add("How");
v.add("are");
v.add("u");
System.out.println(v);
Vector v1 = new Vector(); // Create another vector
v1.add("How");
v1.add("are");
System.out.println(v1.containsAll(v)); // checking the contents of v1
// with v

System.out.println(v.containsAll(v1)); // checking the contents of v
// with v1
}
}

output:
[How, are, u]
false
true

Filed in: Z-A All Java Codes

Comments are closed.