• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

addAll and ContainsAll method in collection

 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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() {
System.out.print("hi");
}
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() {
System.out.print("hi");
System.out.print(a);
}

public static void main(String [] arg) {

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

prasjuly20 pd=new pa();
pd.gi();
pa pf=new pa();
pf.pr();
// pd.gi();
// prasjuly20 pd1=new prasjuly20();


l.add("ho");
l.add("hi");
l.add("prasanna");
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));
System.out.print(l.containsAll(l));
// l.clear();



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


}
}


what is addAll and containsAll method do here
 
Manfred Klug
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic