This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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: 41087
    
  43
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 - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: addAll and ContainsAll method in collection
 
Similar Threads
Problem While Removing Element From List
LinkedList problem
addAll and ContainsAll method in collection
why l.add() method is not working in this context?
NullpointerException in Arrays.sort()