File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes addAll and ContainsAll method in collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "addAll and ContainsAll method in collection" Watch "addAll and ContainsAll method in collection" New topic

addAll and ContainsAll method in collection

Ranch Hand

Joined: Apr 04, 2007
Posts: 188
package welcome;
import java.util.*;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2007</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class prasjuly20 {
static int a=10;

private void foo() {
public void gi() {
System.out.print("go go go");
protected void pr() {
System.out.print("go faf");

class pa extends prasjuly20 {

int b;
int a=11;
public void h() {

public static void main(String [] arg) {

List l=new ArrayList();
prasjuly20 pd1=new prasjuly20();

prasjuly20 pd=new pa();;
pa pf=new pa();;
// prasjuly20 pd1=new prasjuly20();

l.add("foo foo foo ");
l.add(new Integer(42));

System.out.print( l.contains("ho"));
System.out.print( l.addAll(l));
System.out.print( l.addAll(l));
// l.clear();

Iterator i = l.iterator();
while (i.hasNext()) {
System.out.print( l.addAll(l));


what is addAll and containsAll method do here
Manfred Klug
Ranch Hand

Joined: Jun 04, 2007
Posts: 377
Originally posted by prasanna sheregar:
what is addAll and containsAll method do here

Have a look at the API documentation for addAll and containsAll.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Please don't post the same question question multiple times. Now you have answers here and here. This duplication is a waste of people's time, who are trying to help you, after all.
I agree. Here's the link:
subject: addAll and ContainsAll method in collection
It's not a secret anymore!