how to search the pertical objects in a Collections

Answers were Sorted based on User's Feedback



how to search the pertical objects in a Collections..

Answer / raj

We can search by contains(Object) method of collection
class. like
Arraylist list = new ArrayList();
list.add("a");
list.add("b");
if(list.contains("a")
{
--
--
}

Is This Answer Correct ?    2 Yes 0 No

how to search the pertical objects in a Collections..

Answer / manas

corrected of #1 ans:
ArrayList a1=new ArrayList();
a1.add("shiva");
Object e[]=a1.toArray();
for(int i=0;i<a1.size();i++)
{
if(e[i].equals("inputstring");
}
}

Is This Answer Correct ?    2 Yes 0 No

how to search the pertical objects in a Collections..

Answer / siva thimmannagari

ArrayList a1=new ArrayList();
a1.add("shiva");
Object e[]=a1.toArray();
for(int i=0;i<a1.size();i++0
{
if(e[0].equals("inputstring");
}
}

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Advanced Java Interview Questions

Have you used threads in Servelet?

1 Answers   Satyam,


How to do registration form using struts and hibernate?

1 Answers  


i have a 1000 objects in data base i need to display those in jsp's how can i retrive those objects in jsp. (consider the performance issue)

2 Answers  


What is a modular application? What does module-relative mean?

1 Answers  


Why are component architectures useful?

1 Answers  


whats is statement and procedure

1 Answers   TCS,


What is waiting state? In what ways a thread can enter into waiting state?

2 Answers   Wipro,


Are we allowed to change the transaction isolation property in middle of a transaction?

1 Answers  


What are preemptive scheduling and time slicing and what is the difference between them?

1 Answers  


Why does most servlets extend HttpServlet?

4 Answers   Accenture, Wipro,


What are the services in RMI ?

1 Answers  


what are memory considerations of jsp compares to other web components?

1 Answers   TCS,


Categories