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

Why are component architectures useful?

0 Answers  


int x=5,i=1,y=0; while(i<=5) { y=x++ + ++x; i=i+2; } System.out.println(x); System.out.println(y); System.out.println(i); How to solve this? Please explain!

0 Answers  


How to synchronize jsp page?

1 Answers   Infotech, TCS,


What is Bootstrapping in RMI?

1 Answers  


What is the infobus?

0 Answers  






what is meant by JRMP?

0 Answers  


whats is mean by connectionpooling

0 Answers   SolutionNET,


Can I have an action without a form?

0 Answers  


Why use a datasource when you can directly specify a connection details?

0 Answers  


what is the diffrence between banking and insurance domain?

2 Answers  


what is singleton class? where it mainly used in the projects?

5 Answers   Satyam, Wipro,


Why are some of the class and element names counter-intuitive?

0 Answers  


Categories