11:09 pm - Saturday May 27, 2017

Stack Example Program for containsAll(collection)

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

//Stack Example Program for containsAll(Collection c)
/**
* @author   candidjava.com
* @Returns true if this list contains all of the elements of the specified collection.

*/

import java.util.*;

public class Stac {
public static void main(String args[]) {
Stack s = new Stack();// create object for stack
s.push(1);
s.push(3);
s.push(4);
s.push(6);
Stack s1 = new Stack();// create one more stack.
s1.push(1);
s1.push(3);
System.out.println(s.containsAll(s1));// this method checks 's1' stacks
// elements wether present in
// 's' stack or not.
} // if 's1' elements present in 's' then return true else false.
}

Output:
true

Filed in: Z-A All Java Codes

Comments are closed.