/**---------------------------------------------------------*
* @author Madarapu Naveen *
* http://madarapunaveen.blogspot.com *
* ---------------------------------------------------------*
*/
import java.util.ArrayList;
import java.util.List;
public class ArrayListContains {
public static void main(String[] args) {
ArrayList list = new ArrayList();
list.add("Item 1");
list.add("Item 2");
if (list.contains("Item 1")) {
System.out.println("True");
}
else {
System.out.println("False");
}
}
}
This blog is for one who learn about java and open source tools. as a java developer i am writing my experience in this blog.
Friday, March 4, 2011
How do I know if an ArrayList contains a specified item?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment