This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "addAll and ContainsAll method in collection" Watch "addAll and ContainsAll method in collection" New topic
Author

addAll and ContainsAll method in collection

pras
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() {
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

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
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: addAll and ContainsAll method in collection
 
Similar Threads
NullpointerException in Arrays.sort()
addAll and ContainsAll method in collection
LinkedList problem
why l.add() method is not working in this context?
Problem While Removing Element From List