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 an abstract method?

0 Answers  


Why won’t the jvm terminate when I close all the application windows?

0 Answers  


What do you know about seam?

0 Answers  


AS a developer will u create a data source in connection pool? If so how will u do that, how to access the object from connection pool using IRAD tool?

0 Answers  


diff vector arraylist

4 Answers   Saka Solutions,






In real time project when will we use Abstract class. and what are the difference between abstract and interface.

6 Answers   DELL, FCS, Polaris, Tanla Solutions, TCS,


how the mapping can be done from jsp to actionservlet?

2 Answers   SolutionNET,


In inglish: How to convert jar to exe files? Em português: Como converter arquivos .jar para .exe?

0 Answers  


What is Servlet Filter And What does it work?

1 Answers   TCS,


What is re-entrant. Is session beans reentrant. Is entity beans reentrant?

0 Answers  


iam writing the contents to a excel through I/O i am putting first statement as WRITE and then READ(from excel) immediately..later user complains that he is not getting the date by using READ ..wat could be the situation

3 Answers   iGate,


Are enterprise beans allowed to use thread.sleep()?

0 Answers  


Categories