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

what is the use of State Factories?

0 Answers  


JMS based on what technology?

1 Answers  


how do you Handle Front End Application data against DB with example?

0 Answers   Campus Interaction, HCL,


What is the difference between the font and fontmetrics classes?

0 Answers  


How has the sandbox changed with Java 2?

2 Answers  






What is the RMI and Socket?

0 Answers  


What value does readline() return when it has reached the end of a file?

0 Answers  


What is threadfactory?

0 Answers  


What is the infobus?

0 Answers  


What is Stream Tokenizer?

0 Answers   TCS,


Explain the life cycle of servlet?

3 Answers   Cognizant, HCL,


What are the methods used for inter-thread communication? and in what class these methods are defined?

2 Answers  


Categories