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

we use MainFrame and using os390 for operating system with DB2 data base in IRAN and interest programing with java and use webspere for world wide,please help me where i should start?

0 Answers   IBM,


How to implement dphibernate to activate lazy loading in Flex with java ?thanx in advance!

0 Answers  


Do we need to override service() method

0 Answers  


How many requests can a server fetch at a time?

1 Answers  


What are the sequence of steps to write pub or sub model kind of application?

0 Answers   TCS,






What method MUST be implemented by all threads?

1 Answers  


How to deploy Jar, War files in J2EE?

0 Answers   HCL,


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

0 Answers  


what is a Daemon Thread?

2 Answers  


What is the difference between the font and fontmetrics classes?

0 Answers  


What are different types of controls in AWT?

11 Answers   IBM,


What is Lock Based Protocol and what is its use?

2 Answers   Wipro,


Categories